Brian Candler wrote:
> $ ruby19 -E ISO-8859-1 -e 'puts File.open("/etc/passwd").gets.encoding'
> ISO-8859-1

D'oh. I see from original post that you knew this already.

It seems that Ruby keeps state for:
- default external encoding (e.g. for files being read in)
- default internal encoding (not sure what this is, you can set using -E 
too but it defaults to nil)

and these are independent from the encodings of source files, which use 
the magic comments to declare their encoding.

You can read these using Encoding.default_external and 
Encoding.default_internal, but there don't appear to be setters for 
them.

-- 
Posted via http://www.ruby-forum.com/.