default encoding UTF 8?

Discussion in 'Ruby' started by Roger Pack, May 24, 2010.

  1. Roger Pack

    Roger Pack Guest

    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, May 24, 2010
    #1
    1. Advertising

  2. 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/.
     
    Marcin Wolski, May 25, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michel de Becdelièvre
    Replies:
    3
    Views:
    3,026
    Joerg Jooss
    Mar 6, 2006
  2. jmfauth
    Replies:
    4
    Views:
    345
    jmfauth
    Oct 13, 2010
  3. cs_professional
    Replies:
    14
    Views:
    5,560
    cs_professional
    Dec 12, 2010
  4. Replies:
    2
    Views:
    419
  5. Replies:
    2
    Views:
    410
    Nathan Keel
    Aug 14, 2009
Loading...

Share This Page