-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
When converting a Number to a String with the .to_s method, the encoding of the resulting String is US-ASCII/ASCII-8BIT. (This is also the behavior of mri and rubinius/rubinius#2136)
jruby-1.7.2 :001 > __ENCODING__
=> #<Encoding:UTF-8>
jruby-1.7.2 :002 > Encoding.default_internal
=> nil
jruby-1.7.2 :003 > Encoding.default_external
=> #<Encoding:UTF-8>
jruby-1.7.2 :004 > "abc".encoding
=> #<Encoding:UTF-8>
jruby-1.7.2 :005 > 1.to_s.encoding
=> #<Encoding:US-ASCII>
jruby-1.7.2 :006 > 1.to_r.to_s.encoding
=> #<Encoding:ASCII-8BIT>
jruby-1.7.2 :007 > 1.0.to_s.encoding
=> #<Encoding:US-ASCII>
jruby-1.7.2 :008 > Encoding.default_internal = "UTF-8"
=> "UTF-8"
jruby-1.7.2 :009 > 1.0.to_s.encoding
=> #<Encoding:US-ASCII> $ jruby -v
jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) 64-Bit Server VM 1.6.0_37-b06-434-11M3909 [darwin-x86_64]
$ uname -a
Darwin Mandallia.local 12.2.1 Darwin Kernel Version 12.2.1: Thu Oct 18 16:32:48 PDT 2012; root:xnu-2050.20.9~2/RELEASE_X86_64 x86_64
Reactions are currently unavailable