[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unicode support
From: |
Markus Plail |
Subject: |
Re: Unicode support |
Date: |
Fri, 27 Sep 2002 09:48:51 +0200 |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu) |
Hi Pawel, Hu!
* Pawel Kot writes:
>On Fri, 27 Sep 2002, Hu Gang wrote:
>>good propose. It look very cool.
>>
>>Here is the patch.
>The same note:
>+ case 2: /* the value is multi byte
>+ * so can check the before character */
>+ if ( *(dest - 1) == '?' ) {
>+ *(dest - 1) = *dest;
>+ *(dest) = *(dest + 1);
>+ return 1;
>+ }
>I think I don't get it. Why do we even touch *(dest-1)? It may be outside
>our process address space. My understanding of the wctomb is that we give
>it some encoded wide character. And we get the string that may be 1
>character long, 2 characters long, up to MB_CUR_MAX characters long.
>So we store it in the dest. And move the pointer the length - 1 bytes, as
>the loop iteration will move it one byte further.
>So the question: why do we even bother with '2' value? I think we don't
>need to do this at all. But I just woke up, care to enlighten me what do
>I miss?
I thought the same. And with my tests with Hu's test app wctomb always
returned 1 not 2.
So I throw the following code into the ring ;-)
void char_decode_unicode(unsigned char* dest, const unsigned char* src, int len)
{
int i;
for (i = 0; i < len; i++)
wctomb(dest + strlen(dest), (src[i * 2] << 8) | src[(i * 2) +
1]);
return;
}
Works with both my 6210 folders and Hu's test app.
regards
Markus
- 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, 2002/09/26
- Re: Unicode support, Pawel Kot, 2002/09/27
- Re: Unicode support,
Markus Plail <=
- Re: Unicode support, Hu Gang, 2002/09/27
Re: Unicode support, Pawel Kot, 2002/09/27
Re: Unicode support, Pawel Kot, 2002/09/27