diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-15 06:02:51 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-15 06:02:51 +0000 |
commit | d1010584b9a7dd49f50bccb4483bb2c3f3a0c0ee (patch) | |
tree | 03e5ef574521a193361afd1caf95332aa7db0d6b /file.c | |
parent | 75f35328fa450b6058f533a471fa9826142d7aa7 (diff) | |
download | ruby-win32-unicode-test.tar.gz |
* file.c (win32_io_info): UTF-8 handling.win32-unicode-test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/win32-unicode-test@25349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -806,9 +806,14 @@ w32_io_info(VALUE *file, BY_HANDLE_FILE_INFORMATION *st) } else { VALUE tmp; + WCHAR *ptr; + int len; FilePathValue(*file); tmp = rb_str_encode_ospath(*file); - f = CreateFileW((WCHAR *)RSTRING_PTR(tmp), 0, + len = MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, NULL, 0); + ptr = ALLOCA_N(WCHAR, len); + MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, ptr, len); + f = CreateFileW(ptr, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, rb_w32_iswin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS, NULL); |