Re: BUG REPORT: failed with Chinese charaters (I've fixed it)
From:
waterser forrest
Subject:
Re: BUG REPORT: failed with Chinese charaters (I've fixed it)
Date:
Thu, 12 Oct 2006 13:16:25 +0800
Hi, here are some sample dumps, include which there are some chinese characters, I don't know if they'll be displayed properly in your computer, if not, please tell me, I'll send you some screen snapshots so that you can completely understand what I'm saying.
I don't know if the mail list system will keep the font, so please make sure all the stuff I've put here are in font `Courier New'. Otherwise there might be align problems.
I put some comments inside the dumps, which always include some `!' so that you can figure them out easily.
Please note that all cell phone numbers in the dumps are REAL, so please do not put these dumps anywhere else 'coz I don't want my friends' contacts known all over the world :P.
P.S. I sent this reply yesterday but got a `too big' information from the mail list system: Message body is too big: 65177 bytes with a limit of 50 KB
So I have to resend it today after removing some unimportant stuff out of the sample dumps. ========================================
The stderr output generated by the original code (untouched), which is incorrect: ========================================
Getting SMS... ... ... Message received: 0x14 / 0x006e 01 55 00 03 00 01 01 02 00 43 00 00 00 01 00 60 | U C `
44 00 08 60 01 80 02 62 85 23 00 00 00 03 82 10 | D ` b # 01 09 0d 91 68 31 67 31 90 79 f6 00 00 00 82 10 | h1g1 y
02 09 08 91 68 31 08 20 01 05 f0 00 00 00 80 30 | h1 0 2a 15 05 00 03 0f 02 02 6c e8 61 0f 90 fd 67 65 | * l a ge
4e 0d 60 25 4e 86 30 02 53 17 4e ac 73 b0 57 28 | N `%N 0 S N s W( 7a 7f 4e c0 4e 48 88 63 67 0d ff 1f 00 00 | z N NH cg
Received message type 14 Trying to get message # 67 in folder # 2 Type: Deliver Mobile Terminated message: Date: 2006-10-08-20-26-58-+0800 Remote number (recipient or sender): +8613761309976
SMS center number: +8613800210500
UDH found Concatenated messages
Unicode message 注意都来不急了。北京
!!^^^^^^^^^^^^^^^This message is truncated. !!Let's have a look at the 5th line: !!2a 15 05 00 03 0f 02 02 6c e8 61 0f 90 fd 67 65 !!2a=2*15 (HEX) !!Obviously `2a' is the correst length, whereas `15' is just a half. !!`2a' is block[2] and `15' is block[3] !!So I'm sure block[2] indicates the correst length.
========================================
The stderr output generated by the modified code (by me), which is correst (the same message): ======================================== Getting SMS... ... ... Message received: 0x14 / 0x006e 01 55 00 03 00 01 01 02 00 43 00 00 00 01 00 60 | U C `
44 00 08 60 01 80 02 62 85 23 00 00 00 03 82 10 | D ` b # 01 09 0d 91 68 31 67 31 90 79 f6 00 00 00 82 10 | h1g1 y
02 09 08 91 68 31 08 20 01 05 f0 00 00 00 80 30 | h1 0 2a 15 05 00 03 0f 02 02 6c e8 61 0f 90 fd 67 65 | * l a ge
4e 0d 60 25 4e 86 30 02 53 17 4e ac 73 b0 57 28 | N `%N 0 S N s W( 7a 7f 4e c0 4e 48 88 63 67 0d ff 1f 00 00 | z N NH cg
Received message type 14
Trying to get message # 67 in folder # 2 Type: Deliver
Mobile Terminated message: Date: 2006-10-08-20-26-58-+0800 Remote number (recipient or sender): +8613761309976 SMS center number: +8613800210500
UDH found Concatenated messages
Unicode message
注意都来不急了。北京现在穿什么衣服? !!^^^^^^^^^^^^^^^^^^^^^^^^^^^^This message is ok.
========================================
Here is a message which has equal block[2] & block[3]:
========================================
Getting SMS... Getting SMS messag ... ...
Message received: 0x14 / 0x005a 01 55 00 03 00 01 02 02 00 7c 00 00 00 01 00 4c | U | L
04 00 08 60 01 11 61 55 05 23 55 55 55 03 82 10 | ` aU #UUU 01 09 0d 91 68 31 84 68 46 74 f4 55 55 55 82 10 | h1 hFt UUU
02 09 08 91 68 31 08 10 00 05 f0 55 55 55 80 1c | h1 UUU 18 18 90 a3 4e 5f 5f eb 4e 86 00 2e 62 11 9a 6c | N__ N .b l
^^^^^18==18: EQUAL!!!!!!!!!!!!!!!!! 4e 0a 4e 0b 69 7c 63 a5 4f 60 | N N i|c O` Received message type 14 Trying to get message # 124 in folder # 2
Type: Deliver Mobile Terminated message:
Date: 2006-10-11-16-55-50-+0800
Remote number (recipient or sender): +8613488664474 SMS center number: +8613800100500 Unicode message 那也快了.我马上下楼接你
which mean gnokii will test dcs.type with 0x08 to determine if the message is a `Unicode' message.
However, when message[1]==2 (the message type is submit/templates), the `UCS BYTE' should be message[6], but not message[5]
Here is a sample dump:
Getting SMS... ... ... Message received: 0x14 / 0x0052 01 55 00 03 00 05 02 03 00 1f 00 00 00 01 02 44 | U D
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^message[1]==2 21 00 00 08 00 04 82 0c 01 08 0b 81 31 10 92 39 | ! 1 9
!!!!!!!!!^^message[6]=08, which means this is a Unicode message. message[5]=00, obviously not the value we want. 06 f5 82 10 02 09 08 91 68 31 08 10 00 05 f0 00 | h1
00 00 80 14 0e 0e 4e 0b 53 48 67 09 7a 7a 75 35 | N SHg zzu5 8b dd 62 11 00 00 84 0c 07 d6 0a 08 0e 2c 27 00 | b ,'
00 00 | Received message type 14 Trying to get message # 31 in folder # 3 Type: SubmitSent Mobile Originated (sent) message:
Date: 2006-10-08-14-44-39-+0000
Remote number (recipient or sender): 13012993605 SMS center number: +8613800100500 Unicode message 下午有空电话我