From: David Flanagan Date: 2007-11-10T14:19:33+09:00 Subject: Re: primary encoding and source encoding Yukihiro Matsumoto wrote: > Hi, > > In message "Re: primary encoding and source encoding" > on Sat, 10 Nov 2007 03:32:22 +0900, David Flanagan writes: > > |> The role for the primary encoding is the default for file I/O, nothing > |> more. It does (should) not affect the source encoding at all. > > |So -K should *not* set the source encoding if the script does not have a > |coding comment? Won't that cause compatibility problems? > > Compatibility problem. I didn't think about that. So at least -K > should set the default source encoding for files without magic > comments. > > matz. > It seems to me that -E and --encoding should work the same way. And that the primary encoding from the locale should also be the default source encoding. After all, the point of primary encoding is to specify the default encoding for I/O. Reading a ruby script is IO. If we don't know the encoding of the script, the primary encoding should be the default, shouldn't it? Since the supported encodings are all supersets of ASCII, it seems like this will not break scripts that expect a default source encoding of ASCII. (Though I suppose it could introduce performance problems if the coderange stuff in string literals isn't working well.) David