Problems in getting access to files who has Chinese charactors in name.
-----------------------------------------------------------------------

                 Key: JRUBY-2812
                 URL: http://jira.codehaus.org/browse/JRUBY-2812
             Project: JRuby
          Issue Type: Bug
          Components: Interpreter
    Affects Versions: JRuby 1.1.2
         Environment: WinXP SP2; Linux
            Reporter: Tsing


Original post is http://jira.codehaus.org/browse/JRUBY-2677 , when problems 
goes deeper, this issue is created.
All files involved in WinXP is encoded in GB2312, and all files involved in 
Linux is encoded in UTF-8.
My WinXP uses GB2312 as locale, and my Linux uses UTF-8 as locale.

[EMAIL PROTECTED] lib]$ cat test.rb
puts ARGV[0]
puts '中文字符串'
IO.foreach(ARGV[0]) {|line| puts line}
[EMAIL PROTECTED] lib]$ cat txt_en
English string from text file.
中文字符串来自text文件。
[EMAIL PROTECTED] lib]$ cat txt_中文
English string from text file.
中文字符串来自text文件。

[EMAIL PROTECTED] lib]$ java -jar jruby.jar -v
ruby 1.8.6 (2008-05-28 rev 6586) [i386-jruby1.1.2]
[EMAIL PROTECTED] lib]$ java -jar jruby.jar test.rb txt_en
txt_en
中文字符串
English string from text file.
中文字符串来自text文件。
[EMAIL PROTECTED] lib]$ java -jar jruby.jar test.rb txt_中文
txt_??
中文字符串
test.rb:3:in `initialize': No such file or directory - File not found - txt_?? 
(Errno::ENOENT)
        from test.rb:3:in `foreach'
        from test.rb:3

This error comes from the fact that jruby1.1.2 can't process arguments 
containing Chinese charactors correctly.
This bug is reported in Issue JRUBY-2677, and Charles Oliver Nutter fixed it.
[EMAIL PROTECTED] lib]$ java -jar jruby.jar -v
jruby 1.1.3-dev (ruby 1.8.6 patchlevel 114) (2008-07-16 rev 7193) [i386-java]
[EMAIL PROTECTED] lib]$ java -jar jruby.jar test.rb txt_en
txt_en
中文字符串
English string from text file.
中文字符串来自text文件。
[EMAIL PROTECTED] lib]$ java -jar jruby.jar test.rb txt_中文
txt_中文
中文字符串
English string from text file.
中文字符串来自text文件。

It becomes OK because the locale of my Linux is UTF-8.
But when I tried it under WinXP whose locale is GB2312, deeper problems occured.
F:\MyStudio\jruby-1.1.2\bin>jruby.bat -v
jruby 1.1.3-dev (ruby 1.8.6 patchlevel 114) (2008-07-16 rev 7193) [x86-java]
F:\MyStudio\jruby-1.1.2\bin>jruby.bat test.rb txt_中文
txt_中文
中文字符串
test.rb:3:in `initialize': No such file or directory - File not found - txt_????
(Errno::ENOENT)
from test.rb:3:in `foreach'
from test.rb:3

Charles Oliver Nutter's explanation is overhere 
http://jira.codehaus.org/browse/JRUBY-2677?focusedCommentId=142123#action_142123

Afer this weekend I'll have my summer holiday for more than one month, during 
which I will not be able to surf the Internet, so I can't view and post 
comments on this issue.
And I'm just a Chinese college student who is just a beginner in programing, so 
I can't help you too much in fact.
Well, when I return I will  see what had happend.
Good luck!

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to