Why does Windows DIR command produce ??? characters instead of Russian alphabet?

1

On a Windows 10 box, via command line, I run this command:
C:\Users\idiot\Music>dir /a:d /s /b >> tom-music-2016-july.txt

The purpose is to list all directories. But I notice that directories with non-Roman letters in the name will print ????? instead of the Russian or Chinese characters. Why?

Initially I thought that the problem was with system fonts. (I don't have a Russian language pack installed). But I can rename files to Russian file names in Win Explorer. Importantly, when I run the DIR command in the window (without piping it to an output file), I can clearly see Russian characters.

That implies to me that the problem is either with the command which pipes something to a file or the Windows text editor which is trying to read the output.

I tried to open the file in 2 separate text editors and even in a web browser, but I see question mark characters regardless.

Can anybody suggest a cause of this problem and a possible solution?

Am I correct in assuming that I will not need to do any processing on the files or directories themselves? Thanks.

Postscript: I've particularly puzzled about why the Russian characters render fine in the console window but when it's piped to a file, I see the question marks.

rjnagle

Posted 2018-02-03T23:57:05.600

Reputation: 262

see here for a deep explaination of your problem: https://stackoverflow.com/questions/1259084/what-encoding-code-page-is-cmd-exe-using#17177904

– Frank Thomas – 2018-02-04T00:38:32.407

Use an editor which supports the appropriate character set, for example notepad++ – DavidPostill – 2018-02-04T00:52:21.317

I've tried to open in sublime editor, notepad++ and notetab light. Same result. Frank Thomas, as interesting as that question and explanation is, I don't think it explains why it renders fine inside the Windows console but not in the file that the text is outputted to. – rjnagle – 2018-02-04T05:54:57.393

No answers