From: Roger Pack Date: 2010-09-02T11:21:26+09:00 Subject: [ruby-core:32006] Re: not use system for default encoding > Japanese version of Windows uses CP932 (a.k.a. SJIS or Windows-31J). > And its command prompt uses CP932; it's not UTF-8 and can't use UTF-8. > So we must follow locale information. > (almost always locale reflects terminal's encoding) Good to know. I don't mean this as argumentative, but I still have some feedbacks. You can just gloss over them if you're done with the discussion :) I guess my only concern is that if you read in binary data, users of 1.9 *must* specify binary mode. (which is reasonable), but here is my confusion: $ cat test.rb p File.read('other_file_unknown_encoding').encoding p 'abc'.encoding $ ruby test.rb # # for better or worse, even though 'other_file_unknown_encoding' has only ASCII characters, its encoding is set to my system default. This means that if I package up the file "other_file_unknown_encoding" in my gem, and read it later, I *must* specify its encoding when I read it. So it will succeed locally and *fail* on another box, which to me adds extra confusion. Suggestion in this regard: for file input do not use the system to determine encoding. Force users to specify one at least once in code somewhere so they realize the implications of what is happening. The other surprising thing to me is that it assigns IBM437 not only to terminal input but also to file input. *Nobody* edits files in IBM437. It feels inappropriate to use that for the encoding, or, really, to have a default for file encoding. Suggestion in this regard: It should force me to assign an explicit encoding for reading files, or (if I don't) it should default to some less desirable default, like BINARY. How else can you really know what a file encoding was, if it isn't specified? If this were a word processor, I would expect local files to be written in the default locale, but this is reading arbitrary files, so I think it should, again, force people to *at least once* specify their own default external encoding, so that they realize what is going on behind the scenes. Feedbacks? Thanks. -r