Re: Need help

Andreas Fink <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
the problem really is that the phone is sending the message defines  
which character set the message is in. Kannel does pass it to your  
application in the format received. This means you have to convert it  
to whatever you want it to be. There's no way to force a conversion in  
kannel as far as I know...

libiconv is probably handy for that type of conversions.

But as you talked about BINARY sms, its of course clear it has to stay  
binary, meaning kannel wont for sure not convert or touch anyhting as  
its maybe not even considered a character but it could be a image,  
ringtone, setup message etc.


On 01.02.2008, at 12:51, Vitaliy Osaulenko wrote:

> Hi,
>
>    I still have a problem when I try to receive binary sms from  
> mobile phone. I received advice from Andreas Fink. Thanks him for  
> that!
> But as I understand the parameters he proposed to set up related to  
> the situation when we want to send SMS from gateway to device.
> I want to set coding parameter and charset parameter to gateway. So  
> it can use them when he converts binary data to URL. In  
> specification we have %С and %с. But that is used when we want to  
> receive information about coding and charset from gateway. They  
> isn't used to set up that parameters. I wrote advice and problem  
> description below. Could you tell me how I can tune the gateway to  
> receive correct data. Thank you!
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> ADVICE:
>
> A GSM phone doesnt use WINDOWS-1252 charset but it uses GSM-Charset..
>
> The GSM character set is 7 bit, so you can not have values of 128-159
> in it.
> very few characters are coded with an escape sequence.
>
> I think your problem is that if you send binary message, you should
> tell kannel that its binary 8 bit instead of standard 7 bit. Kannel
> will otherwise try to convert. I presume it will try converting from
> ISO (not Windows 1252) to GSM and back. Setting the coding parameter
> to the right value (see users guide) should make it send binary 8 bit
> messages.
>
>
> if used in passing it on http to kannel pass it as &coding=...
>
> 	HTTP Get:
> 	&coding=
> 		message coding: 0 (default, 7 bits), 1 (8 bits) or 2 (Unicode)
> 	&charset=
> 		as in Content-Type: text/html; charset=ISO-8859-1
>
> 	HTTP Put:.
> 	X-Kannel-Coding for message coding
> 		If unset, defaults to 0 (7 bits) if Content-Type is text/plain ,  
> text/html or text/vnd.wap.wml.
> 		On application/octet-stream, defaults to 8 bits (1). All other  
> Content-Type values are rejected.
> 	Content-Type for charset
>
> if used in receiving a URL from kannel, use the placeholder %c for  
> the coding parameter and %C for the charset parameter
>
> from Kannel -> http server:
> 	%c message coding: 0 (default, 7 bits), 1 (8 bits) or 2 (Unicode)
> 	%C	message charset: for a "normal" message, it will be  
> "GSM" (coding=0), "binary" (coding=1) or "UTF-16BE" (coding=2). If  
> the message was successfully recoded from Unicode, it will be  
> "WINDOWS-1252"
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> ORIGINAL PROBLEM DESCRIPTION :
>
> I have a question. I try send binary message to gateway from mobile  
> phone:
>
>
> byte[] original = {77, 67, 65, 83, 72, 32, 33, 216, 21, 199, 102,  
> 84, 199, 230, 2, 164, 183, 47, 130, 157, 125, 96, 186, 213, 42, 94,  
> 79, 203, 210, 50, 76, 232, 174, 76, 49, 146, 187, 217, 34, 27, 18,  
> 135, 197, 64, 82, 197, 66, 65, 115, 213, 23, 77, 153, 34, 243, 58,  
> 231, 220, 192, 11, 120, 15, 9, 148, 53, 215, 126, 2, 110, 38, 11,  
> 135, 190, 176, 107, 155, 231, 2, 176, 159, 86, 132, 128, 45, 91,  
> 144, 98, 63, 115, 110, 228, 37, 200, 194, 38, 219, 135, 41, 233,  
> 138, 117, 246, 29, 211, 6, 213, 178, 216, 79, 70, 0, 45, 187, 223,  
> 189, 110, 99, 228, 108, 196, 33, 72, 125, 64, 135, 218, 202, 228,  
> 216, 170, 62, 80, 139, 128, 0, 0, 0, 0, 0, 0};
>
> I received from gateway next binary parameter:
>
> MCASH+!%D8%15%C7fT%C7%E6%02%A4%B7%2F%1A%1A%7D%60%BA%D5*%5EO%CB%D22L 
> %E8%AEL1%1A%BB%D9%22%1B%12%1A%C5%40R%C5BAs%D5%17M%1A%22%F3%3A%E7%DC 
> %C0%0Bx%0F%09%1A5%D7~%02n%26%0B%1A%BE%B0k%1A%E7%02%B0%1AV%1A%1A-%5B 
> %1Ab%3Fsn%E4%25%C8%C2%26%DB%1A)%E9%1Au%F6%1D%D3%06%D5%B2%D8OF%00-%BB 
> %DF%BDnc%E4l%C4!H%7D%40%1A%DA%CA%E4%D8%AA%3EP%1A%1A%00%00%00%00%00%00
>
> And then do URL decoding with using WINDOWS-1252 charset:
>
> byte[] data = {77, 67, 65, 83, 72, 32, 33, 216, 21, 199, 102, 84,  
> 199, 230, 2, 164, 183, 47, 26, 26, 125, 96, 186, 213, 42, 94, 79,  
> 203, 210, 50, 76, 232, 174, 76, 49, 26, 187, 217, 34, 27, 18, 26,  
> 197, 64, 82, 197, 66, 65, 115, 213, 23, 77, 26, 34, 243, 58, 231,  
> 220, 192, 11, 120, 15, 9, 26, 53, 215, 126, 2, 110, 38, 11, 26, 190,  
> 176, 107, 26, 231, 2, 176, 26, 86, 26, 26, 45, 91, 26, 98, 63, 115,  
> 110, 228, 37, 200, 194, 38, 219, 26, 41, 233, 26, 117, 246, 29, 211,  
> 6, 213, 178, 216, 79, 70, 0, 45, 187, 223, 189, 110, 99, 228, 108,  
> 196, 33, 72, 125, 64, 26, 218, 202, 228, 216, 170, 62, 80, 26, 26,  
> 0, 0, 0, 0, 0, 0};
>
> The data a bit different. Bytes from 128 to 159 converts to 26. I  
> think range is a bit bigger. But it is not important.
> My question to you. Do I something wrong? Or we lost that bytes when  
> gateway performs converting? May be it happens when gateway tries to  
> convert bytes to unicode/utf-8?
> Could I fix that? Could I change config files or sources?
>
>
>
>
>
>
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.