Kasia Luiss
Kasia Luiss

Reputation: 31

How to save a list of directory with files containing Russian or Chinese characters

I need from time to time to make a list of files from a CD I obtain. These filenames frequently contain characters in other writing systems, like Cyrillic Russian (Добродошли.doc) or simplified/traditional Chinese (孟子譯注.pdf). My computer (running under Windows 7, Polish) displays the file names correct, opens the files, saves the files in other locations, lets the files be edited by various software etc. Yet when I am making a directory list (with the dir command) I always obtain question marks and other strange characters instead of the other (Chinese, Russian) characters - the output of the dir command by default seems to be written in ANSI by default - instead of Unicode / UTF8.

Example:

02.03.09 21:13 15˙584˙500 ??????(??????).pdf     = these three files were in Chinese
02.03.09 03:11 18˙638˙982 ????(???).pdf
24.03.08 17:25 61˙141˙454 ???®????Ż(???).pdf 
18.03.13 16:00 1˙088 ????.txt                    = this file's name was in Russian 
02.03.09 21:20 26˙083˙641 Transformations-of-Ming.pdf

(obtained with the Windows Right-Click Context Menu "Print Directory Listing")

I have tried searching for various advice to this problem, and none of the solutions offered has solved my problem - alternatively, I have found (seemingly dated) answers that the problem for the time being cannot be solved under various environments. Maybe something has changes - maybe there is a solution, straight away or after having changed something within the registry of Windows? Or else, if there is no simple batch programming solution - maybe there is some ready software that I could download (for free or buying) to solve my problem?

Upvotes: 3

Views: 9404

Answers (4)

Siad I. Dias
Siad I. Dias

Reputation: 1

Use administrator CMD command prompt"

Method: Press on SHIFT key and RIGHT click with your mouse pointer over the target folder. And choose "open command prompt here" in the drop-down menu. You folder will now be under Administrator access.

In the command prompt window at the command prompt where the text cursor is blinking"

type "chcp 1251" (without the quotes) and press ENTER key to change how command prompt displays contents of directory. This is really the Change Code Page Command an internal change of Windows, you will not see any unicode Cyrillic or Chinese font text as yet.

Now type "dir/w" and press ENTER key this will display all the contents in the target directory.

Right-click and choose "Select All" from drop-down menu. Again press the ENTER key. This copies all text the contents which is now displayed in the command window onto your windows clipboard. Do not close command prompt window as you have some Windows house cleaning to complete.

Launch Notepad.exe ( The Basic windows text editor) or Notepad++ the programmer's favorite text editor ( you can Google and download a copy for free use) and paste your clip board contents into the Editor of your choice. You will see the Cyrillic and Chinese text of the directory contents displayed in their correct fonts. But save the text file with Unicode encoding option.

To return to the old Change Page code native to Windows which is Western European Latin:

type "chcp 1252" at the command prompt and press ENTER key. Close command prompt window.

Upvotes: 0

Andrew Hodson
Andrew Hodson

Reputation: 1

Using Windows'95, run the File Manager, (think = that, same as used + Windows 3.1), it be in the Windows folder, then go to the option to change typeface, & choose a Cyrillic 1. Now 1 may see Russian names of files. Window XP, @ DOS promp use CHCP 866.

Upvotes: -2

Moonwalker
Moonwalker

Reputation: 2232

Setting chcp 65001 solved issue for me. The problem was in wrong code page, at least in my case.

Upvotes: 1

Endoro
Endoro

Reputation: 37589

First, you need a True Type font (TTF) with foreign character support. Install the font:

  • right mouse click on the title bar
  • choose Properties/Fonts
  • if your font is NOT in the list, you must add it before in the registry with the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont\

After installing the font the console displays all foreign characters supported by this font. Commands like dir or redirection to a file dir > dir.txt does also work. And there is no need to change the codepage with chcp.

Upvotes: 0

Related Questions