Re: [PATCH] fix sms_split in sms.c

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
no objections, commited to cvs.

Alexander Malysh wrote:

> Hi,
> 
> seems sms_split function was always buggy and never worked correctly?
> I found two issues:
> 
> 1) max_part_len calculation was wrong.
> It was:
> max_len * 8 / 7 - udh_len
> But because udh nerer packed this is just wrong end should be:
> (max_len - udh_len) * 8 / 7
> 
> 2) we dropped last utf-8 multibyte sequence. (Thanks to Stipe for
> report!).
>     To reproduce just sent following message via smsbox:
>
text=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa%c3%9f
> 
>     To fix the bug we must first convert msgdata to UTF-8 then
>     gsm_truncate
> and then convert it again to UTF-8. The length of UTF-8 string is our
> allowed max_part_length.
> 
> Please find attached patch that should fix those issues.
> Please test and vote!
> 

-- 
Thanks,
Alex
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.