From: "coffeejunk (Maximilian Haack)" Date: 2013-01-31T18:07:57+09:00 Subject: [ruby-core:51775] [ruby-trunk - Bug #7752] Rational/Float/Fixnum/Bignum `.to_s.encoding` is US-ASCII Issue #7752 has been updated by coffeejunk (Maximilian Haack). The only problem I see is that ruby is lying to the user. It is not severe since, as you said, there are no non-ascii characters in the resulting string, but I think ruby should respect the set encoding. ---------------------------------------- Bug #7752: Rational/Float/Fixnum/Bignum `.to_s.encoding` is US-ASCII https://bugs.ruby-lang.org/issues/7752#change-35742 Author: coffeejunk (Maximilian Haack) Status: Open Priority: Normal Assignee: Category: core Target version: 2.0.0 ruby -v: 2.0.0dev =begin When converting an instance of Rational/Float/Fixnum/Bignum to a string with the (({.to_s})) method, the resulting string has the encoding US-ASCII. This happens for 1.9.3 as well as 2.0.0rc1. (({> __ENCODING__})) (({ => #})) (({> Encoding.default_internal})) (({ => #})) (({> Encoding.default_external})) (({ => #})) (({> 1.to_s.encoding})) (({#=> #})) (({> (2/1).to_r.to_s.encoding})) (({ => #})) (({> "abc".encoding})) (({ => #})) =end -- http://bugs.ruby-lang.org/