gnokii-users
[Top][All Lists]
Advanced

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

Re: [PATCH] Fixes for character encoding problems in atgen.c (0.6.0)


From: Pawel Kot
Subject: Re: [PATCH] Fixes for character encoding problems in atgen.c (0.6.0)
Date: Sun, 11 Apr 2004 16:06:10 +0200 (CEST)

On Sat, 13 Mar 2004, Hugo Haas wrote:

Hugo,

> Looking at atgen.c, I noticed that gnokii did the same mistake, as it
> sets the memory type without checking what encoding is used. I also
> noted that gnokii wasn't checking the encoding in ReplyReadPhonebook()
> when receiving a phone number, and --getphonebook would give me:
>
>   1. Name: Foo Bar/H
>   Number: 004500...
>   Group id: 0

Could you please show the output when reading this entry? Your patch
breaks my Nokia 6310 in at least 2 places:
-               sprintf(req, "AT+CPBS=\"%s\"\r", memorynames[mt]);
-               ret = sm_message_send(13, GN_OP_Init, req, state);
+               len = at_encode(drvinst->charset, memtype, memorynames[mt], 
strlen(memorynames[mt]));
+               sprintf(req, "AT+CPBS=\"%s\"\r", memtype);
+               ret = sm_message_send(11 + len, GN_OP_Init, req, state);
I need to give it always in ASCII ie:

Message sent: 0x00 / 0x000d
41 54 2b 43 50 42 53 3d 22 4d 45 22 0d          | AT+CPBS="ME"
write: [AT+CPBS="ME"<cr>]
read : [AT+CPBS="ME"<cr><cr><lf>OK<cr><lf>]
Message received: 0x00 / 0x0013
02 41 54 2b 43 50 42 53 3d 22 4d 45 22 0d 0d 0a |  AT+CPBS="ME"
4f 4b 0d                                        | OK
Received message type 00

instead of:

Message sent: 0x00 / 0x0013
41 54 2b 43 50 42 53 3d 22 30 30 34 64 30 30 34 | AT+CPBS="004d004
35 22 0d                                        | 5"
write: [AT+CPBS="004d0045"<cr>]
read : [AT+CPBS="004d0045"<cr><cr><lf>ERROR<cr><lf>]
Message received: 0x00 / 0x001c
03 41 54 2b 43 50 42 53 3d 22 30 30 34 64 30 30 |  AT+CPBS="004d00
34 35 22 0d 0d 0a 45 52 52 4f 52 0d             | 45"   ERROR
Received message type 00

Yes, I use UCS2 encoding. The second place is the number. It is encoded
ASCII no matter what encoding is set:
Message sent: 0x0d / 0x000a
41 54 2b 43 50 42 52 3d 33 0d                   | AT+CPBR=3
write: [AT+CPBR=3<cr>]
read : [AT+CPBR=3<cr><cr><lf>+CPBR:
3,"+48504000214",145,"005000610077006501420020004B006F0074"<cr><lf><cr><lf>OK<cr><lf>]
Message received: 0x0d / 0x0056
02 41 54 2b 43 50 42 52 3d 33 0d 0d 0a 2b 43 50 |  AT+CPBR=3   +CP
42 52 3a 20 33 2c 22 2b 34 38 35 30 34 30 30 30 | BR: 3,"+48504000
32 31 34 22 2c 31 34 35 2c 22 30 30 35 30 30 30 | 214",145,"005000
36 31 30 30 37 37 30 30 36 35 30 31 34 32 30 30 | 6100770065014200
32 30 30 30 34 42 30 30 36 46 30 30 37 34 22 0d | 20004B006F0074"
0a 0d 0a 4f 4b 0d                               |    OK

I'm applying the patch only in the safe places for now.

thanks,
pkot
-- 
mailto:address@hidden
http://www.gnokii.org/




reply via email to

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