Chinese text SMS

We are testing sms messages using chinese text so that we can send appointment reminders in the customer's language [the macro expression - the english version is concat($patient.name,"'s appointment reminder. We are fully booked today, please arrive on time at ") - the chinese version is concat($patient.name,'預約提醒:請準時到達診所,時間:今日').

However, the chinese version does not come through - only the 'english' characters.

Looking at http://en.wikipedia.org/wiki/GSM_03.38 - which says "characters in languages such as Arabic, Chinese, Korean or Japanese languages must be encoded using the 16-bit UTF-16 character encoding".

If this is indeed the problem (we are checking with the Email-to-SMS provider) then is the fix to provide a hint in the sms test that that the test should be utf-16 encoded.

ie if the text starts with(for example)  ~~ then these two chacters are removed and the remainder of the text is transmitted as utf-16.

HOWEVER - further reading - see http://en.wikipedia.org/wiki/Unicode_and_email - indicates that there may be major problems with sms gateways that want the sms text in the Subject line of the email - since this would need to use the 'Encoded word' format - see RFC 2047.

I will add more when we hear back from the gateway provider.

Regards, Tim G

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Chinese text SMS

Which gateway Tim?

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Chinese text SMS

Ben - its OneWay SMS in Hong Kong.

I have just run a test sending myself the email below which has chinese text both in the body and the subject, and this arrived completely at my end with no loss.

and I can see from the header in the received email

that the subject is UTF-8 encoded. [More precisely as per RFC 2047 it is using UTF-8/B encoding which is in fact Base64.]

Will post more when we hear from the SMS provider.

Regards, Tim G

Re: Chinese text SMS

Yeah I think this is why we need to expand the email subsystem to include html mail as well as other encoders.

I am working on a patch but I keep hitting coding sticking points for me atleast ....just a lack of familiarity with the echo framework I guess.

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Chinese text SMS

Overnight I have been corresponding by email with the OneWay SMS support staff. It turns out that they can adjust their gateway options so as to get the SMS text from the message body of the email rather than its subject.  So we both made the required changes in our configurations and I re-tested.

English language message work, but not those containing chinese characters.

By adjusing the gateway config at our end, I was able to send the emails to me rather that OneWay SMS.

Looking at the headers I see:

a) for the english text one

b) for the one containing chinese characters

From some reading - see for example http://www.javawebdevelop.com/3512946/ - it appears that java is using operating system to decide the character encoding - and in this system (Windows 2003) is set to use traditional chinese - ie

Hence the M950 used by java for the chinese characters.

 

So the next step is to ask OneWay SMS what they so with M950 stuff - and what do they need so that the chinese characters are processed correctly.

Regards, Tim G

Re: Chinese text SMS

Try changing openvpms/WEB-INF/openvpms-web-app.xml from:

<bean id="mailSender" class="org.openvpms.web.component.service.MailService" scope="session"/>

to:

<bean id="mailSender" class="org.openvpms.web.component.service.MailService" scope="session">
   <property name="defaultEncoding" value="UTF-8"/>
</bean>

Re: Chinese text SMS

Tim A - done that but I need to wait until the 4am restart tomorrow morning for it to take effect.  Regards, Tim G

Re: Chinese text SMS

That worked - ie by changing the default mail encoding to UTF-8 I was able to send an SMS containing chinese text and it arrived as desired.

Tim A - I wonder what the downside of making this change in 1.8 is. If none then we should do it.

Regards, Tim G

Re: Chinese text SMS

Can't think of any downside, although I would put it in the constructor of MailService rather than configuring it via Spring.

Syndicate content