gnokii-users
[Top][All Lists]
Advanced

[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 12:58:08 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

Hi Pawel!

* Pawel Kot writes:
>>>>address@hidden 27 September 2002 10:20:55 >>>
>>>>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;
>>>>}
>>Why wouldn't it support wider characters? wctomb adds them to the end
>>of dest. If it's 4 Bytes it adds four bytes. The version now in CVS
>>just discards wider characters.

>Okay. You are right. Two things:
>1. Avoid strlen. It extremly slow.
>2. You need to do this in two more functions. decode_ucs2 and
>decode_unicode_alphabet() [or similiar].

Here is my newest patch:
1. I changed char_en/decode_unicode to return int. this is necessary,
   as cannot know the length of the resulting string from our input.
2. ucs functions aren't yet tested. What are they used for, i.e. how
   can I test if they work properly?
3. With this patch we have to change all char_encode_unicode function
   calls, because I changed the meaning of "int len". So far it had to
   be the length of the resulting string, which is crap, as we can't
   know that length when calling the function.
4. strlen isn't used anymore.

regards
Markus

Attachment: unicode.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]