Re: [Boost-bugs] [Boost C++ Libraries] #3332: boost::filesystem::path will get trobule in locale Chinese_Taiwan.950 (windows)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3332: boost::filesystem::path will get trobule in locale Chinese_Taiwan.950 (windows)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-12-24 13:22:00


#3332: boost::filesystem::path will get trobule in locale Chinese_Taiwan.950
(windows)
-------------------------------------+-------------------------------------
  Reporter: Ching Yi, Chan | Owner: bemandawes
  <chingyichan.tw@…> | Status: closed
      Type: Bugs | Component: filesystem
 Milestone: Boost 1.40.0 | Severity: Problem
   Version: Boost Development | Keywords: encoding cp950 Big5
  Trunk | 0x5c
Resolution: worksforme |
-------------------------------------+-------------------------------------
Changes (by bemandawes):

 * status: assigned => closed
 * resolution: => worksforme

Comment:

 Sorry for the 5 year delay in closing this.

 The problem does not reproduce with current versions of boost.filesystem.
 The path has already been converted to UTF-16 by the time operations
 begin, so the C5 character in cp950 is immaterial.

 Here is an updated test program, using the codepage 950 codecvt facet that
 ships with recent versions of VC++:

 {{{
 #include <boost/filesystem.hpp>
 #include <cvt/cp950>
 #include <iostream>
 #include <string>
 #include <locale>

 namespace fs = boost::filesystem;

 int main(void) {

   std::locale global_loc = std::locale();
   std::locale loc(global_loc, new stdext::cvt::codecvt_cp950<wchar_t>);
   fs::path::imbue(loc);

   std::cout <<
     "HEADS UP! PIPE OUTPUT TO FILE AND INSPECT WITH HEX OR CP950
 EDITOR.\n"
     "WINDOWS COMMAND PROMPT FONTS DON'T SUPPORT CHINESE,\n"
     "EVEN WITH CODEPAGE SET AND EVEN AS OF WIN 10 TECH PREVIEW." <<
 std::endl;

   fs::recursive_directory_iterator end;
   fs::recursive_directory_iterator iter
 ("C:/boost/modular/develop/libs/filesystem/test/issues/3332/test_folder");

   while (iter != end)
   {
     if (fs::is_directory(*iter))
     {
       std::cout << "[directory] " << iter->path().generic_string() <<
 std::endl;
     }
     else if (fs::is_regular(*iter))
     {
       std::cout << " [file] " << iter->path().generic_string() <<
 std::endl;
     }
     ++iter;
   }
   return 0;
 }
 }}}

 A hex dump of the output shows that it does correctly handle the Big5
 characters.

 I've also tested a UTF-8 version of the above, and checked those with a
 UTF-8 aware text editor.

 Thanks,

 --Beman

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3332#comment:5>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC