Author |
Post |
|
#1 Wed Jun 08, 2011 10:28, 163 months ago.
|
Member
Registered: Jul 2010
Location: Hong Kong
|
Operating system name and version: Win2003 - Cygwin Version of smsd: 3.1.14 Smsd installed from: sources Name and model of a modem / phone: Interface: USB
I would like to check if my system need to send different languages, say sometimes Eng, Japanese, etc. What should i need to set? I find that sending english works normally but i cannot send Japanese.
Please advice. Thanks.
|
|
#2 Wed Jun 08, 2011 10:57, 163 months ago.
|
Member
Registered: Jul 2010
Location: Hong Kong
Topic owner
|
I tried using a UTF-8 sms file for different language sms. This is the sms file i made and put to outgoing folder. -------------------------- To: 85293XXXXXX Alphabet: UTF-8 this is test -------------------------- The file has gone after a while. Then in smsd.log, i got the message. 2011-06-08 18:50:58,5, smsd: No destination in file /var/spool/sms/outgoing/tes _sms.txt 2011-06-08 18:50:58,6, smsd: Deleted file /var/spool/sms/outgoing/test_sms.txt What happened? « Last edit by keke on Wed Jun 08, 2011 13:37, 163 months ago. »
|
|
#3 Wed Jun 08, 2011 12:08, 163 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Japanese written messages to be sent using the Unicode character set. The script sendsms does it automatically. If you are creating message files manually, or by your application, you can use the checkhandler for conversion. In the global part of smsd.conf define the following: checkhandler = /usr/local/bin/smsd_checkhandler.shCreate the script with the following content, and make it executable for smsd: #!/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 With English written messages do not use any Alphabet header in SMS file. With Japanese messages use the header Alphabet: UTF-8 and write message body using UTF-8 character set. Checkhandler will convert it to UCS2 and changes the header, and smsd will send message using Unicode character set. « Last edit by keke on Wed Jun 08, 2011 12:53, 163 months ago. »
|
|
#4 Wed Jun 08, 2011 12:44, 163 months ago.
|
Member
Registered: Jul 2010
Location: Hong Kong
Topic owner
|
i added the smsd_checkhandler.sh script, but still the same. Have i done anything wrong? 2011-06-08 20:44:37,7, smsd: Running checkhandler: /usr/local/bin/smsd_checkhand ler.sh /var/spool/sms/outgoing/test_sms.txt 2011-06-08 20:44:38,7, smsd: Done: checkhandler, execution time 1 sec., status: 0 (0) 2011-06-08 20:44:38,5, smsd: No destination in file /var/spool/sms/outgoing/test _sms.txt 2011-06-08 20:44:38,6, smsd: Deleted file /var/spool/sms/outgoing/test_sms.txt sms file: ----------------------------------- To: 東電 データ公表漏れ計1382件 ----------------------------------- sms file: ----------------------------------- To: Alphabet: UFT-8 東電 データ公表漏れ計1382件 ----------------------------------- « Last edit by xpking on Wed Jun 08, 2011 12:48, 163 months ago. »
|
|
#5 Wed Jun 08, 2011 12:52, 163 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Try with Alphabet: UTF-8. Sorry, I had a typo on my previous post... Also check which sed, which grep, which mktemp and which iconv to see if your system has those commands available.
|
|
#6 Wed Jun 08, 2011 13:05, 163 months ago.
|
Member
Registered: Jul 2010
Location: Hong Kong
Topic owner
|
Can you help deleting the mobile number in #2? Thanks.
I checked that which sed, which grep, which mktemp and which iconv, all good result. Also changed the sms file Alphabet: UTF-8, the file encoding "ANSI", no luck.
What is the encoding of the txt file?
|
|
#7 Thu Jun 09, 2011 13:35, 163 months ago.
|
Member
Registered: Jul 2010
Location: Hong Kong
Topic owner
|
i tried many method but still not working. i tried txt file using UTF-8 encoding, but the smsd.log shows no destination in the file. if i use ANSI encoding txt file, i received the SMS content are all ? characters.
any idea to solve this?
|
|
#8 Thu Jun 09, 2011 15:39, 163 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Have you tried the script sendsms from the command line of Cygwin?
The format of SMS file is problematic under Windows. Headers part must be written using ANSI encoding, and in the case of Unicode messages, message body must use 16bit Unicode encoding. Wordpad cannot save this kind of files.
In the scripts directory of a package, there is very old script unicode2sms from version 2 of smstools, but with a quick view it seems that it's not working. I have to think what to do with this case.
|
|
#9 Thu Jun 09, 2011 16:10, 163 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Okay, the problem is caused by Byte Order Mark (BOM) character...
Use Notepad to write messages, save as UTF-8, and use extra dummy header in top:
----------------------------------- a: a To: 1234567890 Alphabet: UTF-8
東電 データ公表漏れ計1382件 -----------------------------------
Checkhandler is still required.
|