User Tools

Site Tools


arabian_characters_encoding

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

arabian_characters_encoding [2016/06/14 16:35] (current)
Line 1: Line 1:
 +===== How to manage arabian characters encoding =====
 +This article illustrates how to manage the Arabian characters'​ encoding inside of the messages of your FoxBox.
  
 +In order to correctly handle other alphabets on received SMS, you just have to modify the //​Eventhandler//​ inserting these new rows:
 +<​code>​
 +#We are creating a Custom Action for incoming messages
 +if [ "​$1"​ = "​RECEIVED"​ ]; then
 +    #We check for the alphabet used, and we convert the message if we find the arabic one
 +    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
 +    ​
 +    #As usual, we later parse the message
 +    /​etc/​sms/​scripts/​parser.php $2
 +fi  ​
 +</​code>​
 +
 +As a result the arabic characters will be recognized, properly handled and shown.
arabian_characters_encoding.txt ยท Last modified: 2016/06/14 16:35 (external edit)