gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some minor fixes for gnokii


From: Pawel Kot
Subject: Re: Some minor fixes for gnokii
Date: Wed, 30 Oct 2002 23:25:51 +0100 (CET)

On Wed, 30 Oct 2002, Jan de Cuveland wrote:

> On Tue, Oct 29, 2002, Pawel Kot wrote:
> >     if (argc && (strcmp("-i", args[0])) && (strcmp("-v", args[0])))
> >         usage(stderr);
> > -   if (!strcmp("-v", args[0]))
> > +   if (argc && !strcmp("-v", args[0]))
>
> I think the modification is indeed needed, since if no argument is
> provided (argc==0), usage() will not be called, but strcmp("-v", args[0])
> tries to access memory which is not allocated, which causes gnokii
> to crash.

Sorry, my logic is broken. Reading it for the 10th time I realized you are
right. Will fix that in few minutes.

You really gave good eye for spotting such things. Many thanks.

> > > * The third is a patch to /common/gsm-encoding.c. The problem is, that
> > >   mbtowc and wctomb do not work as desired with the special characters of
> > >   a latin1 charset.
> >
> > Could you put more light on this? Some example?
>
> I'll try to.
> This is my understanding of what is going on when writing to the phone:
>
> I have my locale set to "de_DE.ISO-8859-1", which means I am using an
> iso-8859-1 single-byte charset, which is of course also used by the
> phonebook data which I provide on stdin. This data is now pushed through
> mbtowc(), which converts a multibyte sequence to a wide character. The
> problem now is, that the input string is NOT a multibyte character, but
> a single-byte character string. So mbtowc() should always fail... but it
> does not, since the first 128 characters of iso-8859-1 are identical to
> their multibyte sequence representation. Now our language uses certain
> special characters, which in iso-8859-1 are encoded with representations
> above 128. For these values, mbtowc() actually fails with an error code.

Okay. It's clear then. But it surprises me. I use iso-8859-2 and also use
characters above 127 code. And it works perfectly. My understanding of
mbtowc() was that even single-byte characters (like these from iso-8859-1
and iso-8859-2) can be used there as the multibyte characters. And correct
locale setting ensures that we have always correct transformation.

If it works as you said mbtowc() and wctomb() are not suitable for us.

> If I (other way round) enter a name into my 6510 that includes some
> special characters, and then try to read the data, gnokii calls wctomb()
> for each character, which again fails for special characters.

Could you please send any dumps with such incorrect transformations?

> If, on the other hand, I forget about these two routines and just do a
> typecast from (char) to (unsigned short) and vice versa, everything works
> like charm.
>
> Now this is my unprofessional suspicion:
> - The phone does not understand unicode after all. They are just using
>   shorts instead of chars for transmission for some reason.

It does. At least my knowledge says so.

> - Because the current procedure works for most characters, nobody has yet
>   reported this misapprehension.

It is very unlikely as it recently worked with Chinese characters and it
also worked with Polish characters. And AFAIK it was also tested with
German characters (Markus?).

> If there is no other solution to the problem in sight, I would appreciate
> it if you could modify *dest as well. Otherwise I'll have question marks
> all over my phonebook...

Fair enough. Hope it won't break anything.

thanks again,
pkot
-- 
mailto:address@hidden :: mailto:address@hidden
http://kt.linuxnews.pl/ :: Kernel Traffic po polsku





reply via email to

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