Codepage 850 character set

Discussion in 'Ruby' started by Dan Smorey Jr., Nov 25, 2005.

  1. 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.
     
    Dan Smorey Jr., Nov 25, 2005
    #1
    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. Mike Prager

    Culture and Codepage question

    Mike Prager, Aug 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    1,452
    Mike Prager
    Aug 30, 2003
  2. Benny Ng
    Replies:
    0
    Views:
    384
    Benny Ng
    Jun 17, 2004
  3. Yahya Saad

    Two Codepage

    Yahya Saad, Oct 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    421
    Yahya Saad
    Oct 13, 2004
  4. Daatmor

    Codepage problem

    Daatmor, Jun 15, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    4,572
    Joerg Jooss
    Jun 17, 2005
  5. MichiMichi
    Replies:
    1
    Views:
    448
    Alexey Smirnov
    Feb 9, 2007
Loading...

Share This Page