From: Yukihiro Matsumoto Date: 2007-11-09T16:46:18+09:00 Subject: Re: primary encoding and source encoding Hi, In message "Re: primary encoding and source encoding" on Fri, 9 Nov 2007 05:42:47 +0900, David Flanagan writes: | |I've got a couple of questions about the handling of primary encoding. |First, here is my understanding of how things currently work in the 1.9 |sources: | |1) The default primary encoding is ASCII. ASCII-8BIT, yes. |2) -K, -E, and --encoding options set primary encoding Yes. |3) The primary encoding is associated with the string or file that |the parser is going to parse, and thus the primary encoding is used as |the default source encoding for the script. 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. |4) If a script contains a coding comment or BOM it overrides the default | it sets the source encoding, overriding the primary encoding. Basically yes. it overriding the default source encoding (ASCII-8BIT). |5) Once the script has been parsed (but before it is executed) the |source encoding is used to set the primary encoding if the primary |encoding was not explicitly specified with -K, -E, or --encoding. This step is not required as far as I understand. matz.