
Hi Beman,
I tested directory_iterator and fstream for Chinese file names on Windows XP Japanese edition. directory_iterator worked correctly, but fstream didn't.
Thanks Takeshi. I'll give your patch a try tomorrow.
Do you have a test case you would like to see added to the regression test?
Woops! I had forgotten to write the test case. I tested this by VC7.1 and VC8. #include <boost/filesystem/fstream.hpp> #include <boost/filesystem/operations.hpp> #include <boost/filesystem/path.hpp> #include <boost/test/unit_test.hpp> #include <locale> // Japanese Hello const wchar_t hello_jp[] = L"\u3053\u3093\u306B\u3061\u306F.txt"; // Chinese Hello const wchar_t hello_cn[] = L"\u4F60\u597D.txt"; namespace fs = boost::filesystem; namespace ut = boost::unit_test; void test_unicode_path_fstream_aux(const fs::wpath& ph) { fs::remove(ph); // open and write 3 bytes fs::ofstream os(ph); os << "abc" << std::flush; os.close(); // check by "true" Unicode function BOOST_CHECK_EQUAL(fs::file_size(ph), 3); fs::remove(ph); } void test_unicode_path_fstream() { // Dinkumware's fstream requires this for non-ASCII filename std::locale::global(std::locale("")); test_unicode_path_fstream_aux(fs::wpath(hello_jp)); test_unicode_path_fstream_aux(fs::wpath(hello_cn)); } ut::test_suite* init_unit_test_suite(int, char* []) { ut::test_suite* test = BOOST_TEST_SUITE("test wpath fstream"); test->add(BOOST_TEST_CASE(&test_unicode_path_fstream)); return test; } Regards, Takeshi Mouri