Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > default encoding UTF 8?

Reply
Thread Tools

default encoding UTF 8?

 
 
Roger Pack
Guest
Posts: n/a
 
      05-24-2010
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/.

 
Reply With Quote
 
 
 
 
Marcin Wolski
Guest
Posts: n/a
 
      05-25-2010
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/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
String default encoding: UTF-16 or Platform's default charset? cs_professional Java 14 12-12-2010 06:10 PM
Wrong default endianess in utf-16 and utf-32 !? jmfauth Python 4 10-13-2010 07:07 AM
UTF - SEEK_SET workaround for BOM encoding(utf-16/32) layer Bug sln@netherlands.com Perl Misc 2 08-13-2009 11:35 PM
Reading Text File Encoding and converting to Perls internal UTF-8 encoding sln@netherlands.com Perl Misc 2 04-17-2009 11:22 PM
=?Utf-8?Q?why_=E2=80=9CTKIP=E2=80=9D_displays_in_the_WSETT?==?Utf-8?Q?ING.txt_when_I_select_AES_as_the?==?Utf-8?Q?_a?= =?Utf-8?B?S2VpdGg=?= Wireless Networking 6 03-14-2006 10:36 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57