[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Encoding and the windows environment, a question.

AD60

8/5/2008 10:20:00 PM

Contrary to established wisdom I named my user on my windows (Vista)
system "André" (with an e-acute). It is my name after all. The
Dir.glob method shows my home directory using ISO-8859-15 encoding.
The thing that puzzles me is that when I request my home directory
from the environment I have to convert from codepage 850. Why are two
different methods of encoding used when requesting more or less the
same information from the operating system?

This program shows what I mean:

require 'iconv'

puts "See my user directory here:"
p Dir.glob("/Users/*")

puts "Now look at the environment:"
a = ENV["HOMEPATH"]
p a
puts a

puts "To get it right:"
converter = Iconv.new('ISO-8859-15', 'CP850')
b = converter.iconv(a)
p b
puts b

OUTPUT:

See my user directory here:
["/Users/Andr\351", "/Users/Chantal", "/Users/Default", "/Users/
desktop.ini", "/Users/Public"]
Now look at the environment:
"\\Users\\Andr\202"
\Users\Andr‚
To get it right:
"\\Users\\Andr\351"
\Users\André


1 Answer

BizarroBush

10/5/2007 11:16:00 PM

0


"Matt Rantis" <harangueman@yahoo.com> wrote in message
news:1191625317.446277.136170@19g2000hsx.googlegroups.com...
> On Oct 5, 9:32 am, Harry Hope <riv...@ix.netcom.com> wrote:
>> http://www.snopes.com/military/li...
>>
>> Draft Notice
>>
>> Claim: Talk radio host Rush Limbaugh was disqualified from the
>> Vietnam-era draft due to a pilonidal cyst.
>
>
> Did you get that from Elizabeth Edwards, who apparently considers
> herself a physician? Maybe her husband sued a medical school and, in
> lieu of a cash settlement, accepted an honorary MD for his wife.

Is Elizabeth Edwards a War cheerleader like you republican phoneys?