Re: issue with char_mbtowc/iconv
Raphaël <[email protected]> Thu, 9 May 2013 23:34:00 +0200
| Newsgroups | gmane.linux.drivers.gnokii |
|---|---|
| Message-ID | <20130509213359.GB27763@b1b1> |
On Tue, Apr 16, 2013 at 08:14:08PM +0200, Raphaël Droz wrote: > On Tue, Apr 16, 2013 at 07:06:43PM +0200, Daniele Forsi wrote: > > 2013/4/15 Raphaël Droz: > > > > > # let's convert > > >> char_mbtowc/iconv: Argument invalide > > > # let's store converted string > > >> AT+CPBW=771,"0030003000300030",129,"0052" > > > > > > 0052 is only the first "R" as the conversion failed after the first char. > > > > I fixed this bug which could be reproduced with the fake driver from git: > > echo -e "BEGIN:VCARD\r\nFN:Régine\r\nTEL;TYPE=PREF,VOICE:0000\r\nEND:VCARD\r\n" > > | gnokii --phone fake --writephonebook --vcard --overwrite > > can you test it? > > fixed! > (tested both in fake mode and real use) > ... but I don't understand how this could have been undetected up to now... > > Anyway, thank you ! ... it just beat me again in a subtle case, and AFAIR it's not the first time LANG is discussed: Using LANG=C (what is sometimes useful), gn_char_get_encoding() is initialized to ANSI_X3.4-1968 and that's the charset chosen to treat an input vcard file... so obviously char_mbtowc() fails (with an UTF-8 vcf). It could be good to write it down somewhere so that other people could understand: $LANG not only affect the gnokii output language, but *also* the way it treats input files (what IHMO isn't appropriate ;)) regards