[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unicode support
From: |
Hu Gang |
Subject: |
Re: Unicode support |
Date: |
Fri, 27 Sep 2002 09:33:44 +0800 |
On Fri, 27 Sep 2002 00:55:17 +0200 (CEST)
Pawel Kot <address@hidden> wrote:
|Notes and questions:
|- if (mbtowc(&retval, &value, 1) == -1) return '?';
|+ if (mbtowc(&retval, &value, 1) == -1) return 0;
|
|Why that? It will truncate the string on the character that is not
|supported by the current locale.
Yes, I'm wrong. now return '?'.
|
|It doesn't look good:
|+ if (tmp != 0)
|+ dest[i - 1] = tmp; /* is right ? */
|and
|+ if (tmp != 0) dest[i - 1] = tmp;
|It will crash on i == 0;
>From my patch, Only the wide character is two byte, tmp is not 0,
So the tmp can not is 0 when i == 0. But do check is needed.
|I would propose something like this:
|static unsigned int char_decode_uni_alphabet(wchar_t value, unsigned char
*dest)
|{
| unsigned int retval;
|
| switch (retval = wctomb(dest, value)) {
| case -1:
| *dest = '?';
| return 1;
| default:
| return retval;
| }
|}
good propose. It look very cool.
Here is the patch.
--
- Hu Gang
fix_unicode
Description: Binary data
pgpI9vD2sWujO.pgp
Description: PGP signature
- Re: Unicode support, (continued)
Re: Unicode support, Pawel Kot, 2002/09/26
Re: Unicode support, Pawel Kot, 2002/09/26
Re: Unicode support, Pawel Kot, 2002/09/26
Re: Unicode support,
Hu Gang <=
Re: Unicode support, Pawel Kot, 2002/09/27
Re: Unicode support, Markus Plail, 2002/09/27
Re: Unicode support, Hu Gang, 2002/09/27
Re: Unicode support, Pawel Kot, 2002/09/27
Re: Unicode support, Pawel Kot, 2002/09/27