From: Brian Candler Date: 2008-12-16T01:16:55+09:00 Subject: Re: ruby 1.9.1: Encoding trouble: broken US-ASCII String Yukihiro Matsumoto wrote: > The whole picture must be complex, since encoding support itself is > VERY complex indeed. History sucks. But for daily use, just remember > specifying encoding if you are not sure what is the default_encoding, > e.g. > > f = open(path, "r:iso-8859-1") 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. 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/.