Changeset 17040

Show
Ignore:
Timestamp:
08/04/08 02:37:31 (5 years ago)
Author:
saturday06
Message:

iconv...???

Location:
lang/cplusplus/i3
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/i3/intl/loadmsgcat.c.windows-utf16

    r17039 r17040  
    55/**/ 
    66 
     7#include <windows.h> 
    78int 
    89open_windows_utf8(const char *pathname8, int flags) 
    910{ 
    10     wchar_t  pathname16[1000] = {}; 
    11     { // iconv 
    12         iconv_t  cd; 
    13         wchar_t* pathname16_iterator; 
    14         size_t   pathname16_bytes_left; 
    15         char*    pathname8_iterator; 
    16         size_t   pathname8_bytes_left; 
    17         int      result; 
    18  
    19         pathname16_iterator = (char*)pathname16; 
    20         pathname16_bytes_left = sizeof(pathname16) -1;//"-1" for null term 
    21         pathname8_iterator = pathname8; 
    22         pathname8_bytes_left = strlen(pathname8); 
    23          
    24         cd = iconv_open("UTF-16LE", "UTF-8"); 
    25  
    26         result = iconv(cd,  
    27                        &pathname8_iterator,  
    28                        &pathname8_bytes_left, 
    29                        (char*)&pathname16_iterator, 
    30                        &pathname16_bytes_left); 
    31          
    32         if (result == -1) { 
    33             errno = EACCES; 
    34             return -1; 
    35         } 
    36          
    37         iconv_close(cd); 
     11    wchar_t pathname16[1000]; 
     12    if (0 == MultiByteToWideChar( 
     13            CP_UTF8, 
     14            0, 
     15            pathname8, 
     16            -1, 
     17            pathname16, 
     18            sizeof(pathname16))) { 
     19        return -1; 
    3820    } 
    3921    return _wopen(pathname16, flags); 
  • lang/cplusplus/i3/src/LibintlUtf16le.h

    r17038 r17040  
    2323 
    2424namespace i3 { 
    25     extern const char* locale_dir_utf8_; 
     25    extern const char* windows_locale_dir_utf8_; 
    2626} 
    2727#undef LOCALEDIR 
    28 #define LOCALEDIR (i3::locale_dir_utf8_) 
     28#define LOCALEDIR (i3::windows_locale_dir_utf8_) 
    2929 
    3030#endif