Dave Thomas wrote:
> 
> On Feb 6, 2008, at 3:37 PM, NARUSE, Yui wrote:
> 
>>> I thought -E set the encoding for source files (and, by extension, 
>>> the strings etc in those files). Is this not the case?
>>
>> -E doesn't set "the encoding for source files".  We call this as 
>> "string literal encoding".  (this includes regexp literal etc)  -E set 
>> only Encoding.default_external.
> 
> If so, that's a change from a few weeks ago, where -E set the default 
> encoding for the source code for files that didn't have an explicit 
> magic comment.

Ahhh, yes, -E set string literal encoding in Ruby 1.9.0.0, and this was 
changed at r15099 and r15226.

> However, now -E doesn't seem to work:
> 
> dave[RUBY3/Book 15:57:20] cat t.rb
> # encoding: utf-8
> p __ENCODING__
> puts "¦Ð"
> 
> (if it doesn't make it through the list software, the string above 
> contains a utf-8 pi character)
> 
> 
> dave[RUBY3/Book 15:59:54] ruby t.rb
> #<Encoding:UTF-8>
> ¦Ð
> 
> 
> Now delete the magic comment:
> 
> dave[RUBY3/Book 16:00:25] cat t.rb
> p __ENCODING__
> puts "¦Ð"
> dave[RUBY3/Book 16:00:49] ruby t.rb
> t.rb:2: invalid multibyte char
> t.rb:2: invalid multibyte char
> dave[RUBY3/Book 16:00:53] ruby -Eutf-8 t.rb
> t.rb:2: invalid multibyte char
> t.rb:2: invalid multibyte char

-- 
NARUSE, Yui  <naruse / airemix.com>
DBDB A476 FDBD 9450 02CD 0EFC BCE3 C388 472E C1EA