I’m a ruby beginner. As I had installed NetBeans6.0 in WinXP_SP2, I
chose jruby to practise.
But there is a problem when passing Chinese Characters(I’m Chinese) as
command line
arguments, jruby doesn’t received them correctly.
For example, here is a test.rb:
ARGV.each do |arg|
puts “#{arg}\n”
end
(Taking the consideration of the unsupport of Chinese character of your
computer, I use @ to
replace these Chinese characters:)
The command is “jruby test.rb @@@”, but the string jruby puts to STDOUT
is simply “???”. As
you see, jruby uses exactly the same amounts of ‘?’ to replace Chinese
charactors.
The version of jruby came along with NetBeans6.0 is 1.0.2. Then I
download the 1.1.2, but
the problem is still existed.
PS:
If I place the test.rb under a path with Chinese Charactors(such as
D:@@\test.rb),
jruby_1.0.2 can process test.rb but can’t process the Chinese characters
as arguments; while
using newer jruby_1.12, it even can’t get acess to test.rb(Report can’t
find D:??\test.rb),
and it still can’t process the Chinese characters as arguments.
Pure Ruby is OK, and Chinese charactors gets form text files(enc=cp936)
is also OK under
jruby.
I have tested “java -jar jruby.jar @@@”, and the problem is the same, so
I’m sure this bug
doesn’t exist in the batch files.
Thanks.