Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* 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
  • Loading branch information...
commit d1010584b9a7dd49f50bccb4483bb2c3f3a0c0ee 1 parent 75f3532
unak authored October 15, 2009

Showing 2 changed files with 10 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  ChangeLog
  2. 7  file.c
4  ChangeLog
... ...
@@ -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
+
1 5
 Thu Oct 15 14:52:34 2009  NAKAMURA Usaku  <usa@ruby-lang.org>
2 6
 
3 7
 	* file.c (rb_str_encode_ospath): no more gurantee that the returned
7  file.c
@@ -806,9 +806,14 @@ w32_io_info(VALUE *file, BY_HANDLE_FILE_INFORMATION *st)
806 806
     }
807 807
     else {
808 808
 	VALUE tmp;
  809
+	WCHAR *ptr;
  810
+	int len;
809 811
 	FilePathValue(*file);
810 812
 	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,
812 817
 			FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
813 818
 			rb_w32_iswin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS,
814 819
 			NULL);

0 notes on commit d101058

Please sign in to comment.
Something went wrong with that request. Please try again.