Project

General

Profile

Actions

Bug #7752

closed

Rational/Float/Fixnum/Bignum `.to_s.encoding` is US-ASCII

Added by coffeejunk (Maximilian Haack) almost 12 years ago. Updated almost 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
ruby -v:
2.0.0dev
Backport:
[ruby-core:51735]

Description

=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:UTF-8}))

(({> Encoding.default_internal}))
(({ => #Encoding:UTF-8}))

(({> Encoding.default_external}))
(({ => #Encoding:UTF-8}))

(({> 1.to_s.encoding}))
(({#=> #Encoding:US-ASCII}))

(({> (2/1).to_r.to_s.encoding}))
(({ => #Encoding:US-ASCII}))

(({> "abc".encoding}))
(({ => #Encoding:UTF-8}))

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0