Feature #1966
closedwindows unicode mkdir
Description
=begin
Dear Ruby developers,
I'm interested in proper unicode support on windows, therefor I dive into Ruby sources and prepared initial patch (see in attachemet) which adds unicode support for mkdir. It is heavily inspired by code which is already in place in IO.c file. However, it opens many questions.
- It is obvious that Ruby is based on POSIX and whole windows support is one big hack (I apologize, I didn't meant to offend somebody). So instead of calling directly POSIX mkdir, I introduced method pi_mkdir, i.e. "platform independend" or "platform interface" mkdir, which is ifdeffed to dir_s_mkdir_internal on POSIX systems and to rb_w32_mkdir on windows.
- Since the file system encoding is platform specific. Therefore I changed interface of rb_w32_mkdir from (const char *, int) to (unsigned long, int). The unsigned long should be actually VALUE of RString. Unfortunately, in C it is not possible to use type deffed VALUE in exported functions, therefore I felt back to unsigned long. Anybody has idea for nice solution?
- I introduced w32_utf16 method which returns utf16 encoding for string conversions. Initially, I thought that it could be static global variable. Unfortunately, I did not found proper place for one time initialization. Is there some suitable place?
- The w32_utf16 function could be replaced by some method like RStringToWChar. Is there such method by chance?
- Is somewhere described naming conventions? Where to use rb_ prefix etc? It seems to me that the naming is rather unclear.
- Is there some recommendation regarding white spaces? In .c files, there is always mix of spaces and tabs which is not good.
It might be that I forgot some questions, so I will ask them in discussion :)
=end
Files
Updated by vo.x (Vit Ondruch) almost 16 years ago
- File testmkdir.rb testmkdir.rb added
=begin
Snippet of appropriate rubyspec test case.
=end
Updated by vo.x (Vit Ondruch) almost 16 years ago
=begin
I also forgot that check_dirname is not unicode encoding aware and should be fixed.
=end
Updated by vo.x (Vit Ondruch) almost 16 years ago
=begin
Needed to say that encoding support on POSIX system is in worser shape than on windows. If UTF-8 string is used, then everything is fine, however, every other encoding is problematic. It means that dir_s_mkdir_internal should be fixed and should change string encoding into UTF-8.
=end
Updated by vo.x (Vit Ondruch) almost 16 years ago
=begin
I also left there non unicode code branch, but I feel it should be abandoned.
=end
Updated by vo.x (Vit Ondruch) almost 16 years ago
=begin
Can somebody close this issue please? This issue is rendered obsolete by [ruby-core:25220] discussion.
Vit
=end