This shows you the differences between two versions of the page.
— |
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. |