Newbie-Question: recursive_directory_iterator and Unicode
Hi all, i'm using the following code-part to show a file-listing of the current directory: boost::locale::generator gen; std::locale l = gen(""); std::locale::global(l); boost::filesystem::recursive_directory_iterator it(L"."); boost::filesystem::recursive_directory_iterator itEnd; while (it != itEnd) { if (boost::filesystem::status_known(it->status()) && boost::filesystem::is_regular(it->status())) { cout << it->path() << endl; } ++it; } This work's great but not if some files contain unicode-characters. If so, then a lot of ????'s will be printed. Could anyone show me how to print those unicode-characters to stdout? Using wcout won't print anything. I'm new to boost and unicode and i'm not sure if this is a problem of boost! I'm using MinGW (gcc (tdm-1) 4.6.1), Boost 1-52, ICU 50.1 - Output goes to the windows command-prompt (Already tried "chcp 65001") Thanks, Andreas
On 16/11/12 20:15, Andy wrote:
Hi all,
I'm using MinGW (gcc (tdm-1) 4.6.1), Boost 1-52, ICU 50.1 - Output goes to the windows command-prompt (Already tried "chcp 65001")
Thanks, Andreas
Use Boost.Nowide (it's not in yet, it has a review scheduling), it's by the same awesome guy who did Boost.Locale. It fixes the Windows command prompt to use UTF-8, with no code page changing necessary. Enjoy, Jookia.
participants (2)
-
Andy
-
Jookia