Project

General

Profile

Actions

Bug #5863

closed

Integer#chr may return a string with multiple characters

Added by john_firebaugh (John Firebaugh) over 12 years ago. Updated over 12 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
Backport:
[ruby-core:41972]

Description

=begin
Is this a bug?

256.chr("SHIFT_JIS").length #=> 2

I think so, as it means that #chr and #ord can't be treated as inverses, and is generally confusing.

If not, the documentation for #chr should be changed, as it implies that the returned string is always a single character.
=end


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #5855: inconsistent treatment of 8 bit characters in US-ASCIIClosednaruse (Yui NARUSE)01/07/2012Actions
Has duplicate Ruby master - Bug #5864: Integer#chr raises on some invalid codepoints but returns an invalidly-encoded string for othersClosed01/08/2012Actions
Actions

Also available in: Atom PDF

Like0
Like0