Hi Kannel developers I have encountered an issue where an automated test that works on 1.4.4 fails on 1.5.0. To cut a long story short (more detail below), I am testing that sending a UCS2 message sent to myself, with mo-recode set to true in my SMSbox config, comes back with the UTF-8 I am expecting to my web service.
The gateway invocation that I used previously was this: http://kannel:13003/cgi-bin/sendsms?username=smsuser1&password=xxxxxx&smsc=loopback&from=%2B447441912278&to=%2B447441912278&text=%00%21%00T%00e%00S%00t%00%21%00+O%60Y%7Dg%0BS%CB%00M%00i%00c%00h%00a%00e%00l&charset=UCS-2&coding=2<http://kannel:13003/cgi-bin/sendsms?username=smsuser1&password=akw8NfKmH5&smsc=loopback&from=%2B447441912278&to=%2B447441912278&text=%00%21%00T%00e%00S%00t%00%21%00+O%60Y%7Dg%0BS%CB%00M%00i%00c%00h%00a%00e%00l&charset=UCS-2&coding=2> The php code used to generate the string prior to url encoding: $smsbodyutf8 = '!TeSt! 你好朋友Michael'; $smsbodyucs2 = iconv('UTF-8', 'UCS-2BE', $smsbodyutf8); This test used to work on 1.4.4, but on build 5173 it fails, returning this text: '℀吀攀匀琀℀ 恏絙୧쭓䴀椀挀栀愀攀氀’ which is random chinese garbage. It now requires this to work correctly: http://kannel:13003/cgi-bin/sendsms?username=smsuser1&password=xxxxxx&smsc=loopback&from=%2B447441912278&to=%2B447441912278&text=%21%00T%00e%00S%00t%00%21%00+%00%60O%7DY%0Bg%CBSM%00i%00c%00h%00a%00e%00l%00&charset=UCS-2&coding=2<http://kannel:13003/cgi-bin/sendsms?username=smsuser1&password=akw8NfKmH5&smsc=loopback&from=%2B447441912278&to=%2B447441912278&text=%21%00T%00e%00S%00t%00%21%00+%00%60O%7DY%0Bg%CBSM%00i%00c%00h%00a%00e%00l%00&charset=UCS-2&coding=2> The code to generate the encoded UCS2 is now this (prior to url encoding): $smsbodyutf8 = '!TeSt! 你好朋友Michael'; $smsbodyucs2 = iconv('UTF-8', 'UCS-2LE', $smsbodyutf8); In both cases the log line 'INFO: MO message converted from UCS-2 to UTF-8’ appears without error. What’s strange is that in gw/smsbox.c:1666 it looks as if its expecting to decode from UTF16-BE … so without digging too deeply into the code I am going to assume that it’s translated from UCS-2 elsewhere to UTF16-BE, and maybe whatever library has switched from assuming BE to LE … or something. Over to you ... Environment is x86_64 debian jessie from the docker hub, running in a docker container on a MacBook pro. config attached. All the best and keep up the good work lads and lasses! Jim RedMatter Ltd Jim Page VP Mobile Services +44 (0)333 150 1666 +44 (0)7870 361412 jim.p...@redmatter.com<mailto:jim.p...@redmatter.com>
kannel.conf
Description: kannel.conf