8000 * file.c (win32_io_info): UTF-8 handling. · documenting-ruby/ruby@d101058 · GitHub
[go: up one dir, main page]

Skip to content

Commit d101058

Browse files
committed
* file.c (win32_io_info): UTF-8 handling.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/win32-unicode-test@25349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 75f3532 commit d101058

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Thu Oct 15 15:02:29 2009 NAKAMURA Usaku <usa@ruby-lang.org>
2+
3+
* file.c (win32_io_info): UTF-8 handling.
4+
15
Thu Oct 15 14:52:34 2009 NAKAMURA Usaku <usa@ruby-lang.org>
26

37
* file.c (rb_str_encode_ospath): no more gurantee that the returned

file.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,14 @@ w32_io_info(VALUE *file, BY_HANDLE_FILE_INFORMATION *st)
806806
}
807807
else {
808808
VALUE tmp;
809+
WCHAR *ptr;
810+
int len;
809811
FilePathValue(*file);
810812
tmp = rb_str_encode_ospath(*file);
811-
f = CreateFileW((WCHAR *)RSTRING_PTR(tmp), 0,
813+
len = MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, NULL, 0);
814+
ptr = ALLOCA_N(WCHAR, len);
815+
MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, ptr, len);
816+
f = CreateFileW(ptr, 0,
812817
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
813818
rb_w32_iswin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS,
814819
NULL);

0 commit comments

Comments
 (0)
0