Boost logo

Boost Users :

Subject: [Boost-users] Newbie-Question: recursive_directory_iterator and Unicode
From: Andy (andy_x86_at_[hidden])
Date: 2012-11-16 04:15:33


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net