Hi,

At Mon, 27 Oct 2008 15:57:03 +0900,
Michael Selig wrote in [ruby-core:19535]:
> > Even in 1.8 or prior, -Ks has been mandatory for Shift_JIS
> > sources, so they have had -K in the shebang lines already.
> 
> Why then can I write a ruby 1.8 script which does a "puts" of a Shift_JIS  
> string (no shebang or magic comment), and have it run fine without -Ks?

Because you are avoiding troublesome chars.  Without such
chars, we can't write the words "display", "table", "software"
and "ruby".

> >> I guess if necessary James can put "-KU" in the RUBYOPT environment
> >> variable to save having to add multiple magic comments, but I feel this
> >> shouldn't be necessary.
> >
> > -U option would be better.
> 
> I don't think that will work:
> 
> t2.rb is a single line script which does a puts of a short UTF-8 multibyte  
> string.

Indeed.  -U sets only internal encoding, whereas -Ku sets also
external and source encodings.  Therefore -U isn't direct
replacement for -Ku.

But it's very ambiguous and dangerous to imply encodings.  We
can't trust locale for this purpose, at least.

You can use BOM to mean that the source is written in UTF-8.

-- 
Nobu Nakada