Project

General

Profile

Actions

Bug #5855

closed

inconsistent treatment of 8 bit characters in US-ASCII

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

Status:
Closed
Target version:
-
ruby -v:
Backport:
[ruby-core:41949]

Description

=begin
Does Ruby allow 8 bit characters (127-255) in a US-ASCII encoded string, or not?

"\u{80}".encode("US-ASCII") #=> Encoding::UndefinedConversionError
0x80.chr("US-ASCII") #=> "\x80" (US-ASCII encoding)
"".encode("US-ASCII") << 128 #=> "\x80" (US-ASCII encoding)
"".encode("US-ASCII") << 128.chr #=> "\x80" (ASCII-8BIT encoding)
=end


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #5863: Integer#chr may return a string with multiple charactersClosed01/08/2012Actions
Related to 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
Like0Like0Like0Like0Like0Like0