Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: Function returning int instead of char

Reply
Thread Tools

Re: Function returning int instead of char

 
 
Navaneeth
Guest
Posts: n/a
 
      12-21-2010

> 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
 
Reply With Quote
 
 
 
 
David Resnick
Guest
Posts: n/a
 
      12-21-2010
On Dec 21, 9:10*am, Navaneeth <navaneet...@gmail.com> 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
 
Reply With Quote
 
 
 
 
Nobody
Guest
Posts: n/a
 
      12-21-2010
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).

 
Reply With Quote
 
Ben Pfaff
Guest
Posts: n/a
 
      12-21-2010
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
 
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
Re: Function returning int instead of char Navaneeth C Programming 2 12-22-2010 01:01 AM
Re: Function returning int instead of char BartC C Programming 2 12-20-2010 07:47 PM
int main(int argc, char *argv[] ) vs int main(int argc, char **argv ) Hal Styli C Programming 14 01-20-2004 10:00 PM
newbie: char* int and char *int trey C Programming 7 09-10-2003 03:24 AM
dirty stuff: f(int,int) cast to f(struct{int,int}) Schnoffos C Programming 2 06-27-2003 03:13 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57