Pasha Zubkov wrote:
+ if (c > 127) {
+ c = ((c ^ 192)
<< 6) + (getc(p) ^ 128);
+ } else if (c > 223) {
+ c = ((c ^ 224) << 12)
+ ((getc(p) ^ 128) << 6) + (getc(p) ^ 128);
+ } else if (c > 239) {
+ c = ((c ^ 240) << 18) +
((getc(p) ^ 128) << 12) + ((getc(p) ^ 128) << 6) + (getc(p) ^ 128);
+ }
+ } while (c != EOF &&
!iswprint(c)
As a general rule, you shouldn't implement UTF-8 support in such
hard-coded way. Please look at mbrtowcs() function and its friends. They
convert from the locale encoding (be it ru_RU.KOI8-R or ru_RU.UTF-8) to
wchar_t.
--
Alexander E. Patrakov
Don't mail to [EMAIL PROTECTED]: the server is off until 2006-01-11
Use my GMail or linuxfromscratch address instead
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page