Project

General

Profile

Actions

Bug #5567

closed

IO#set_encoding ignores one invalid encoding unless a second argument is passed

Added by brixen (Brian Shirai) over 12 years ago. Updated about 12 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.0.0dev (2011-10-26 trunk 33526) [x86_64-darwin10.8.0]
Backport:
[ruby-core:40726]

Description

IO.set_encoding will ignore one invalid encoding unless a second argument is passed. This is odd behavior. See below:

sasha:rubinius brian$ ruby2.0 -v -e 'STDOUT.set_encoding("wtfzomgbbq")'
ruby 2.0.0dev (2011-10-26 trunk 33526) [x86_64-darwin10.8.0]
-e:1: warning: Unsupported encoding wtfzomgbbq ignored

BUT

sasha:rubinius brian$ ruby2.0 -v -e 'STDOUT.set_encoding("wtfzomgbbq", "wtf")'
ruby 2.0.0dev (2011-10-26 trunk 33526) [x86_64-darwin10.8.0]
-e:1:in set_encoding': unknown encoding name - wtfzomgbbq (ArgumentError) from -e:1:in '

Is this intentional?

If this is fixed, please backport to 1.9.2 or 3.

Thanks,
Brian

Actions

Also available in: Atom PDF

Like0
Like0Like0