Re: [PATCH] fix sms_split in sms.c
Andreas Fink <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
On 07.02.2007, at 00:50, Stipe Tolj wrote: > 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 +1 on this one from me. It is in fact wrong and I'm very surprised that no one has spotted this before. I remember reading through this splitting stuff and redoing it in my own preprocessor (that was in back in 2001...) and I have not spotted it neither (now I wonder if my code did it wrong too... but its out of service since a while anyway) >> 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=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >> aa%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! +0.5 Can't comment on that one as the UTF-8 magic is not known to me yet. As far as I know, sending UTF-16 shouldnt be an issue in splitting as the phone reasembles it. In UTF-8 its our internal stuff so we should calculate how many GSM chars we would waste there. So the approach sounds right... > Since this has a serious impact, I'd suggest we apply it (if voted > positive) to the 1.4.1 branch and release 1.4.2 from that seperated > CVS branch immediately. So we have a fix for the "old" latin1 > internal encoding. This would only apply to the first patch part then... Andreas Fink Fink Consulting GmbH Global Networks Schweiz AG BebbiCell AG --------------------------------------------------------------- Tel: +41-61-6666330 Fax: +41-61-6666331 Mobile: +41-79-2457333 Address: Clarastrasse 3, 4058 Basel, Switzerland E-Mail: [email protected] www.finkconsulting.com www.global-networks.ch www.bebbicell.ch --------------------------------------------------------------- ICQ: 8239353 MSN: [email protected] AIM: smsrelay Skype: andreasfink Yahoo: finkconsulting SMS: +41792457333