Output of non-ascii characters via pipe

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
May 30, 2008
206
1
#1
I have some files containing non-ascii characters, it can be either Scandinavian characters like åäö, but also non-ascii apostrophes and accent marks.

Do someone know why this happens:

C:\User\temp\ok>dir /b åäö*
åäö.7z
åäö.rar

When just outputting them via DIR they display correctly.

C:\User\temp\ok>dir /b åäö* | for %x in (@con) echo %x
???.7z
???.rar

But if I do the equivalent thing with a pipe they are garbled.

...

I actually found the problem when I wrote up this, if I enable Unicode output it works as I want to.

However, can there be other side-effects to doing that? I just read another post that HISTORY /R does not work with Unicode input files. Does this option also affect how SHRALIAS saves the history when it unloads?
 

rconn

Administrator
Staff member
May 14, 2008
10,101
85
#2
nikbackm wrote:

> I have some files containing non-ascii characters, it can be either Scandinavian characters like åäö, but also non-ascii apostrophes and accent marks.
>
> Do someone know why this happens:
>
> C:\User\temp\ok>dir /b åäö*
> åäö.7z
> åäö.rar
>
> When just outputting them via DIR they display correctly.
>
> C:\User\temp\ok>dir /b åäö* | for %x in (@con) echo %x
> ???.7z
> ???.rar
>
> But if I do the equivalent thing with a pipe they are garbled.
>
> ...
>
> I actually found the problem when I wrote up this, if I enable Unicode output it works as I want to.
>
> However, can there be other side-effects to doing that? I just read another post that HISTORY /R does not work with Unicode input files. Does this option also affect how SHRALIAS saves the history when it unloads?
The problem with HISTORY /R was fixed several builds ago.

It does not affect SHRALIAS, which always saves in Unicode format.

Rex Conn
JP Software