Re: Fw: Re: catenate the ff fe prefix in UTF-16 encoded octstr and swapping bytes in words (if it tnecessary)

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Centrium GmbH
Message-ID <[email protected]>
Hi,

On Friday 19 September 2003 16:07, Yury Mikhienko wrote:
[snip]

>
> in this case - yes, but now I modify my code to:
>
>     if (msg->sms.coding == DC_UCS2) {
>     /*
>      * remove the first two bytes FE FF from octetstring (add from yuryx
> for SMSCv3.2) *
>      */
>         Octstr *octstr_tmp = NULL;
>         short UTF_16_PREFIX = 0xfffe;
>
>       #if (defined (__sparc__) || defined (__sparc) || defined (__sun))
>         UTF_16_PREFIX = 0xfeff; /* in SPARC low byte follow from hight byte
> in word (in INTEL, bytes swap in memory) */ #endif
>
>       octstr_swap_bytes(pdu->u.submit_sm.short_message);     /* <--------
> that necessary for properlly work with UTF-16 encoded content (I use cocoon
> for serializing output content on each request) */ octstr_tmp =

swapping bytes is not needed , because it's normally done in the external box 
(e.g. smsbox). So if your box send UCS2-LE then it's your problem, just send 
msgdata as UCS2-BE and it will work...

> octstr_create("");
>       octstr_append_data(octstr_tmp, (char*) &UTF_16_PREFIX, 2);
>       if(octstr_ncompare(pdu->u.submit_sm.short_message, octstr_tmp, 2) ==
> 0) { octstr_delete(pdu->u.submit_sm.short_message, 0, 2);
>       }
>       octstr_destroy(octstr_tmp);
>     }

ff fe should be removed indeed...

[snip]

>
> I found and correct the wrong code in pdu_pack function (smpp_pdu.c) in
> optional parameters packing section also diff in attachment

[snip]

agreed, it's a bug and should be fixed...but we must encode all integers for 
optional parameters and not only tag, length...

-- 
Best regards / Mit besten Grüßen aus Düsseldorf

Dipl.-Ing.
Alexander Malysh
___________________________________________

Centrium GmbH
Vogelsanger Weg 80
40470 Düsseldorf

Fon: +49 (0211) 74 84 51 80
Fax: +49 (0211) 277 49 109

email: [email protected]
web: www.centrium.de
msn: [email protected]
icq: 98063111
___________________________________________

Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
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.