From: Yukihiro Matsumoto Date: 2008-12-16T02:31:50+09:00 Subject: Re: ruby 1.9.1: Encoding trouble: broken US-ASCII String Hi, In message "Re: ruby 1.9.1: Encoding trouble: broken US-ASCII String" on Tue, 16 Dec 2008 01:16:55 +0900, Brian Candler writes: |It seems to go against DRY to have to write "r:binary" or "rb:binary" |when opening lots of binary files. But if I remember to use |#!/usr/bin/ruby -Knw everywhere that should be OK. | |However, I also don't like the unstated assumption that all Strings |contain text. open(path, "rb") is your friend. It sets encoding to binary. |In RFC2045 (MIME), there is a distinction made between 7bit text, 8bit |text, and binary data. | |But if you label a string as "binary", Ruby changes this to |"ASCII-8BIT". I think that is a misrepresentation of that data, if it is |not actually ASCII-based text. I would much rather it made no assertion |about the content than a wrong assertion. |-- |Posted via http://www.ruby-forum.com/. |