problem matching accented chars on OS X

Discussion in 'Ruby' started by Alex Fenton, Jun 11, 2005.

  1. Alex Fenton

    Alex Fenton Guest

    Hi

    I'm finding words within strings in Western European languages, so I
    need to account
    for accented characters, such as ê (e circumflex) and à (a grave). On
    ruby 1.8.2
    MSW the following works for me (simplified):

    WORD_PATTERN = /^[\w\xC0-\xD6\xD8-\xF6\xF8-\xFF]+$/s

    \w gets me a-z + A-Z , the hex characters are the positions of the
    accented characters in
    iso-8859-1 encoding. This seems to work, but when I run the same code on
    OS X, I get

    .../lib/weft/backend/sqlite.rb:533: mismatch multibyte code length in
    char-class range: /^[\w\xC0-\xD6\xD8-\xF6\xF8-\xFF]+$/ (SyntaxError)

    Any pointers? I'm not sure what is going wrong.

    Is there a library written that can help me matching letter characters
    (ideally in a
    variety of codesets)? [:alpha:] regex class seeemed to be synonymous
    with \w, which
    doesn't match enough.

    cheers
    alex
     
    Alex Fenton, Jun 11, 2005
    #1
    1. Advertisements

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. Kosio

    Floats to chars and chars to floats

    Kosio, Sep 16, 2005, in forum: C Programming
    Replies:
    44
    Views:
    1,873
    Tim Rentsch
    Sep 23, 2005
  2. tech
    Replies:
    12
    Views:
    1,035
    Jerry Coffin
    Jun 24, 2008
  3. Hongyu
    Replies:
    9
    Views:
    1,259
    James Kanze
    Aug 8, 2008
  4. M.Posseth

    receiving ??? chars instead of "special" chars

    M.Posseth, Nov 15, 2004, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    516
    Dan Rogers
    Nov 16, 2004
  5. Luis Paulo Oliveira

    Output problem with accented characters

    Luis Paulo Oliveira, Jan 26, 2004, in forum: Ruby
    Replies:
    1
    Views:
    168
    Josef 'Jupp' SCHUGT
    Jan 27, 2004
  6. Manoel Lemos
    Replies:
    2
    Views:
    209
    Daniel DeLorme
    Jun 1, 2007
  7. Thomas Luedeke
    Replies:
    4
    Views:
    417
    Thomas Luedeke
    Mar 2, 2011
  8. Marc Bissonnette

    Pattern matching : not matching problem

    Marc Bissonnette, Jan 8, 2004, in forum: Perl Misc
    Replies:
    9
    Views:
    514
    Marc Bissonnette
    Jan 13, 2004
Loading...