Project

General

Profile

Actions

Bug #4908

closed

#force_encoding(nil) fails on Windows

Added by yimutang (Joey Zhou) almost 10 years ago. Updated almost 10 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
Backport:
[ruby-core:37238]

Description

I read from The Ruby Programming Language that nil can be specified as "binary" or "ascii-8bit".
The book give a sample code on Page 61:

text = stream.readline.force_encoding("utf-8")
bytes = text.dup.force_encoding(nil) # nil encoding means binary

However, force_encoding(nil) doesn't work on Windows, it will raise a TypeError.
Maybe it's a bug for Windows?

ruby 1.9.2p180 (2011-02-18) [i386-mingw32]

Updated by naruse (Yui NARUSE) almost 10 years ago

  • Status changed from Open to Rejected

The feature is changed on 1.9.2; now nil is not a valid argument.

Actions

Also available in: Atom PDF