Default encoding UTF 8?

Is this expected?

File.read('picture.jpg').encoding

=> #<Encoding:UTF-8>

Encoding.default_external

=> #<Encoding:UTF-8>

Shouldn't default_external be "ASCII-8BIT"? Who is setting my
default_external?

Sorry a but confused.
Thanks!
-rp

···

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

Roger Pack wrote:

Is this expected?

File.read('picture.jpg').encoding

=> #<Encoding:UTF-8>

Encoding.default_external

=> #<Encoding:UTF-8>

Shouldn't default_external be "ASCII-8BIT"? Who is setting my
default_external?

Sorry a but confused.
Thanks!
-rp

"The default external encoding is something different: this is the
encoding that Ruby uses by default when reading from files and streams.
The default external encoding is global to the Ruby process and does not
change from file to file. Normally, the default external encoding is set
based on the locale that your computer is configured to. " - From "the
ruby programming language" book

···

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

Hi,

Is this expected?

File.read('picture.jpg').encoding

=> #<Encoding:UTF-8>

Encoding.default_external

=> #<Encoding:UTF-8>

Yes.

Shouldn't default_external be "ASCII-8BIT"? Who is setting my
default_external?

It's set according to your locale setting.

              matz.

···

In message "Re: default encoding UTF 8?" on Tue, 25 May 2010 01:10:19 +0900, Roger Pack <rogerpack2005@gmail.com> writes: