3
4

2 回答 2

2

Example:

#!/usr/bin/env ruby19

str = "ἄβαξ"
puts "#{str} - encoding: #{str.encoding.name} / size: #{str.size}"
str.each_char do |c|
  puts c
end

Using some Google-fu, you'll find a lot of good articles on Ruby 1.9 and character encoding.

于 2010-01-07T21:41:07.383 回答
1

The following seems to work in 1.9

testStr="ἄβαξ"
testStr.each_char { |k|
        puts k
}
于 2010-01-07T21:42:03.643 回答