Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Codepage 850 character set

Reply
Thread Tools

Codepage 850 character set

 
 
Dan Smorey Jr.
Guest
Posts: n/a
 
      11-25-2005
Can anybody tell me how to read this information with Ruby? I
received a file encoded with the Codepage 850 character set. Vim
opens the file and reads the characters like this...

<90>lodie

The <90> should be a codepage 850 character \220. I am however able
to open this file in Emacs and the character actually shows \220, and
actually equals only one character. Here's what it looks like in
Emacs...

\220lodie

So, I'm almost positive the client is sending me the file correctly,
and it's correctly encoded in Codepage 850 character set. However,
how do I use Ruby to process this file? When I loop through the
characters of the word in question, Ruby is counting the character as
2 characters, even though Emacs shows it as one when I cursor over it.

When I open the file and read the above string in ruby using this code...

p.each_byte do |c|
print c, ' '
end

I get this output...

194 144 108 111 100 105 101

You'll notice there are 7 characters (bytes) there, however, Emacs
only comes out with 6, the \220 being one of them. And I'm close to
certain that the 194 and 144 should be the first character, but not
sure how to get it to come out that way.

What I need to do is be able to read this information in (using Ruby),
and insert into a mysql table, but so far I'm not even sure how to
read this information in Ruby.

Thanks for any help you can offer.


 
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
How to set the default Codepage when storing .aspx document MichiMichi ASP .Net 1 02-09-2007 08:13 AM
Codepage problem Daatmor ASP .Net 4 06-17-2005 03:03 PM
Two Codepage Yahya Saad ASP .Net 0 10-13-2004 07:56 AM
Which Codepage and Charset i should used? Benny Ng ASP .Net 0 06-17-2004 07:46 PM
Culture and Codepage question Mike Prager ASP .Net 2 08-30-2003 07:22 PM



Advertisments