SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Sat Oct 19, 2019 02:01
SMSTools3 Community » Help and support Bottom

[answered] Accentuated character conversion

Admin comment: Includes checkhandler and eventhandler for Unicode messages.

  This topic is locked

Page:  1

Author Post
Member
Registered:
Oct 2009
Location: Latvia
Operating system name and version: Linux bubba 2.6.26.5 #3 Thu Aug 6 14:46:56 CEST 2009 ppc GNU/Linux
Version of smsd: 3.1.5.
Smsd installed from: sources
Name and model of a modem / phone: Nokia 30
Interface: serial to USB adapter

Hi!
I would like to set up smsd to correctly work with accentuated characters:

My setup now:
locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

config:
decode_unicode_text = yes
incoming_utf8 = yes
cs_convert = yes

I did tried first two with different combinations, but without success - accentuated characters are wrong.

If incoming message are only with Latin characters and both decode_unicode_text and incoming_utf8 is set to "no", then Alphabet: ISO.
If incoming message are with accentuated characters, the Alphabet: UCS2

What I am missing?
Thanks in advance!

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Current version of smsd does not convert Unicode messages properly when a message is written using your language. Internal conversion is limited to ISO character set only. Next version will fix this issue.

You can use incoming_utf8, it should work because it's applied only for messages which are delivered using the GSM character set.

Use the eventhandler to convert incoming messages. In global part of smsd.conf, define:
eventhandler = /usr/local/bin/smsd_eventhandler.sh

Create this file with a following content:

#!/bin/bash

if [ "$1" == "RECEIVED" ]; then

  if sed -e '/^$/ q' < "$2" | grep "^Alphabet: UCS2" > /dev/null; then
    TMPFILE=`mktemp /tmp/smsd_XXXXXX`
    sed -e '/^$/ q' < "$2" | sed -e 's/Alphabet: UCS2/Alphabet: UTF-8/g' > $TMPFILE
    sed -e '1,/^$/ d' < "$2" | iconv -f UNICODEBIG -t UTF-8 >> $TMPFILE
    mv $TMPFILE "$2"
  fi

fi
 
'bash' Syntax Highlight powered by GeSHi


Make the file executable (chmod 755 /usr/local/bin/smsd_eventhandler.sh) and restart the daemon using the sms3 script.

Do you have this problem with outgoing messages too?

For curiosity, can you show what characters were incorrect?

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
Yes, the same problem is for outgoing SMS.

The accentuated characters you can see in this page:
http://www.daily-tangents.com/Notes/LV-Fonts.shtml

Look for table "HTML CODING FOR LATVIAN LETTERS"

I will try that event handler latter and report on results.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Thanks for the link. You will need Unicode encoding for those characters and it means that single SMS can contain 70 characters only.

For easier usage with smsd below 3.2, use the checkhandler to convert outgoing messages:
checkhandler = /usr/local/bin/smsd_checkhandler.sh

#!/bin/bash

if sed -e '/^$/ q' < "$1" | grep "^Alphabet: UTF-8" > /dev/null; then
  TMPFILE=`mktemp /tmp/smsd_XXXXXX`
  sed -e '/^$/ q' < "$1" | sed -e 's/Alphabet: UTF-8/Alphabet: UCS2/g' > $TMPFILE
  sed -e '1,/^$/ d' < "$1" | iconv -f UTF-8 -t UNICODEBIG >> $TMPFILE
  mv $TMPFILE "$1"
fi
 
'bash' Syntax Highlight powered by GeSHi


When you create a message which contains accentuated characters, use the header Alphabet: UTF-8 and write a message body using that encoding. For example:

To: 358401234567
Alphabet: UTF-8

Here is: Amacron  Ā, Emacron  Ē, Imacron  Ī, ...

The checkhandler will convert a message body to UCS2 and replaces the header.

If you want to send SMS with english text and 160 characters in single part, just leave the Alphabet header out.

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
What about concatenation an splitting?
Will that do not allow more then 70 chars per message?

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
With "single SMS" I actually meant single part, sorry.

On SMS can consist of maximum 255 parts, in theory. Some phones do not support this large count of parts. One part can contain 160 characters with GSM alphabet, or 70 characters with Unicode. If a text is longer than this limit, there will be more than one parts and information of concatenation is included in each part. This reduces number of useable characters to 153 (GSM) or 67 (Unicode) in each part. Message sent using Unicode can then have 17085 characters maximum.

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
With incoming messages it just worked, but for out coming no:

I am getting
Fail reason: Invalid alphabet

This is my eventhandler script:


Member
Registered:
Oct 2009
Location: Latvia
Topic owner
I also modified sendsms for ease of work:

Added alphabet setting
After line
$echo "To: $destination" >> $TMPFILE
I inserted:
$echo "Alphabet: UTF-8" >> $TMPFILE

But as it did not work I took that line away.

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
Ups - sorry!
For outgoing I needed checkhandler not eventhandler!

It also just works.
:-)
Thank you for you support.

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.