Re: Function returning int instead of char

Discussion in 'C Programming' started by Navaneeth, Dec 21, 2010.

  1. Navaneeth

    Navaneeth Guest


    > But please consider using another library. C99 has its own functions to
    > do this and there are other high-quality UTF-8 libraries out there.
    > Apart from using the wrong return type, the author has taken what is
    > essentially a stateless encoding and added some state to the decoder so
    > that the code is not re-entrant. It seems like a broken design.


    Can you please point to the other UTF8 libraries? I have already seen ICU, but that is too big for me. I just need to support UTF8.

    Thanks
     
    Navaneeth, Dec 21, 2010
    #1
    1. Advertising

  2. On Dec 21, 9:10 am, Navaneeth <> wrote:
    > > But please consider using another library.  C99 has its own functions to
    > > do this and there are other high-quality UTF-8 libraries out there.
    > > Apart from using the wrong return type, the author has taken what is
    > > essentially a stateless encoding and added some state to the decoder so
    > > that the code is not re-entrant.  It seems like a broken design.

    >
    > Can you please point to the other UTF8 libraries? I have already seen ICU, but that is too big for me. I just need to support UTF8.
    >
    > Thanks


    Might get better advice on which library is best if you ask somewhere
    dedicated to your specific platform, e.g. a windows group or
    comp.unix.programmer. But iconv may be what you are looking for?
    http://www.gnu.org/software/libiconv/

    -David
     
    David Resnick, Dec 21, 2010
    #2
    1. Advertising

  3. Navaneeth

    Nobody Guest

    On Tue, 21 Dec 2010 06:10:57 -0800, Navaneeth wrote:

    >> But please consider using another library. C99 has its own functions to
    >> do this and there are other high-quality UTF-8 libraries out there.
    >> Apart from using the wrong return type, the author has taken what is
    >> essentially a stateless encoding and added some state to the decoder so
    >> that the code is not re-entrant. It seems like a broken design.

    >
    > Can you please point to the other UTF8 libraries? I have already seen ICU,
    > but that is too big for me. I just need to support UTF8.


    You don't necessarily need a library. If your system has a UTF-8 locale,
    select that with e.g. setlocale(LC_CTYPE, "en_US.utf8") then use mbtowc(),
    mbrtowc(), mbstowcs() etc.

    If you don't have a UTF-8 locale or don't want to change the program's
    locale settings, a UTF-8 decoder isn't exactly a lot of work (exactly how
    much work depends upon how much effort you want to put into error
    detection and recovery; if you assume valid UTF-8, it's trivial).
     
    Nobody, Dec 21, 2010
    #3
  4. Navaneeth

    Ben Pfaff Guest

    Navaneeth <> writes:

    > Can you please point to the other UTF8 libraries? I have
    > already seen ICU, but that is too big for me. I just need to
    > support UTF8.


    Here is one:
    http://www.gnu.org/software/libunistring/
    --
    "I hope, some day, to learn to read.
    It seems to be even harder than writing."
    --Richard Heathfield
     
    Ben Pfaff, Dec 21, 2010
    #4
    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. Schnoffos
    Replies:
    2
    Views:
    1,225
    Martien Verbruggen
    Jun 27, 2003
  2. trey

    newbie: char* int and char *int

    trey, Sep 10, 2003, in forum: C Programming
    Replies:
    7
    Views:
    405
    Irrwahn Grausewitz
    Sep 10, 2003
  3. Hal Styli
    Replies:
    14
    Views:
    1,650
    Old Wolf
    Jan 20, 2004
  4. BartC
    Replies:
    2
    Views:
    320
    BartC
    Dec 20, 2010
  5. Navaneeth

    Re: Function returning int instead of char

    Navaneeth, Dec 21, 2010, in forum: C Programming
    Replies:
    2
    Views:
    322
    Keith Thompson
    Dec 22, 2010
Loading...

Share This Page