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