gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnokii charset in procmailrc


From: Anna Skorokhodova (Yandex)
Subject: gnokii charset in procmailrc
Date: Fri, 29 Jun 2012 01:45:55 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

Dear list,

can't sendsms in russian via procmail
OS: Debian,  2.6.26-1-amd64
Gnokii:  0.6.29.dfsg-1

In shell everything is OK
mail2:~$ echo "я пришел к тебе с приветом" | sudo gnokii --sendsms XXXXXXXXX
successfully delivers Rus  characters

but if i use gnokii in procmail i get (empty) body of sms while it's in Rus (in Eng it delivers all text correctly)

locale is LANG=ru_RU.UTF-8

to reach the goal i send an e-mail to specially created account sms. it's .procmailrc splits e-mail headers and gives parts to gnokii.

.procmailrc
------------
VERBOSE=yes
LOGFILE=$HOME/procmail.log
SMSDEST=`formail -xFollowup-To:`
SUBJ_FIELD=`formail -xSubject: | tr -d '\n' | sed -e 's/^ //' | /usr/bin/perl -MEncode -ne 'print encode ("utf8",decode ("MIME-Header",$_ )) '`
FROM_FIELD=`formail -xFrom:`
DATE=`formail -xDate:`
SMS_LOG=`date +"%Y%m"`
:0
| echo -e "$SUBJ_FIELD" | sudo gnokii --sendsms $SMSDEST >> $HOME/gnokii.log 2>&1 && echo -e "$DATE | $FROM_FIELD\t\t| $SMSDEST | $SUBJ_FIELD" >> /var/www/sms/$SMS_LOG

procmail.log
----------------
procmail: Executing "formail,-xFollowup-To:"
procmail: Assigning "SMSDEST= XXXXXXXXX"
procmail: Executing "formail -xSubject: | tr -d '\n' | sed -e 's/^ //' | /usr/bin/perl -MEncode -ne 'print encode ("utf8",decode ("MIME-Header",$_ )) '"
procmail: Assigning "SUBJ_FIELD=я пришел к тебе"
procmail: Executing "formail,-xFrom:"
procmail: Assigning "FROM_FIELD= "Anna Skorokhodova" <address@hidden>"
procmail: Executing "formail,-xDate:"
procmail: Assigning "DATE= Thu, 28 Jun 2012 17:09:01 +0400"
procmail: Executing "date,+%Y%m"
procmail: Assigning "SMS_LOG=201206"
procmail: Executing " echo -e "$SUBJ_FIELD" | sudo gnokii --sendsms $SMSDEST >> $HOME/gnokii.log 2>&1 && echo -e "$DATE | $FROM_FIELD\t\t| $SMSDEST | $SUBJ_FIELD" >> /var/www/sms/$SMS_LOG" procmail: Assigning "LASTFOLDER= echo -e "$SUBJ_FIELD" | sudo gnokii --sendsms $SMSDEST >> $HOME/gnokii.log 2>&1 && echo -e "$DATE | $FROM_FIELD\t\t| $SMSDEST | $SUBJ_FIELD" >> /var/www/sms/$SMS_LOG" procmail: Notified comsat: "sms@:/home/sms/ echo -e "$SUBJ_FIELD" | sudo gnokii --sendsms $SMSDEST >> $HOME/gnokii.log 2>&1 && echo -e "$DATE | $FROM_FIELD\t\t| $SMSDEST | $SUBJ_FIELD" >> /var/www/sms/$SMS_LOG"
From address@hidden  Thu Jun 28 17:09:06 2012
 Subject: =?KOI8-R?Q?=D1_=D0=D2=C9=DB=C5=CC_=CB_=D4=C5=C2=C5?=
Folder: echo -e "$SUBJ_FIELD" | sudo gnokii --sendsms $SMSDEST >> $ 1000

gnokii.log
--------------
GNOKII Version 0.6.29
ucs2_encode/iconv: Invalid or incomplete multibyte or wide character
ucs2_encode/iconv: Invalid or incomplete multibyte or wide character

as you can find Subject field was correctly decoded from koi8-r MIME to utf8.

What should i do to get rus chars in sms via procmail?

Thanks ahead.

--
A.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]