I'm facing a strange problem in one of my Debian server, what is happening right now it that I have runned dpkg-reconfigure locales to set en_US UTF-8 so in that way I could use accentuation in my system.
# locale -a
C
en_US.utf8
POSIX
pt_BR.utf8
However, when I create a new file via console like vi test and I try to use "�" or "�" for example the char is broken.
# vi --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jul 12 2010 12:49:33)
Included patches: 1-445
I did the
:set encoding=utf8
however that didn't work, my problem is, I have a script that have a email on it that when a user match a specific query, it sends an e-mail through exim. These e-mail is in Portuguese that is the reason that I'm getting this issue.
The character set of the email has little to do with the character set of the system, by the way. You need to use MIME types to tell the email client the incoming data is UTF8 and not ASCII.
Yes, that is UTF-8.
I changed the locale again and now somethings are working.
Let me try to explain it better.
Right now I have this script:
...
cat <<EOF > $MESSAGE_FILE
Prezado(a) $NOME,
Usu�rio: $NAME
Celular : $PHONE
Valor : R$ $VALOR
Mes de Referencia: $REFERENCIA
Voc� est� recebendo esta notifica��o por estar em desacordo com a pol�tica de uso de celulares vigente da XXXX, no Brasil.
O gasto mensal do seu celular est� acima do previsto pela pol�tica.
Sugerimos que abra um chamado no help desk (8080) para que possamos adequar seus planos de voz e /ou dados � sua necessidade.
A pol�tica vigente encontra-se na p�gina web:
Atenciosamente,
IT Networks & Telecom
EOF
cat $MESSAGE_FILE | mailx -a "From: notreply@XXXX.com" notreply@XXXX.com -b AAAAA@XXXX.com -s "Uso de Celular Excedido em $REFERENCIA / Cell Phone Use Exceeded in $REFERENCIA"
...
If I create a test file that have the previous text and try the command line to send me the e-mail, the e-mail looks great, however when I run the script, the e-mail that I receive is broken:
Usu�o:
Celular : Linha
Valor : R$ DDD
Mes de Referencia: Commercial
Voc�st�ecebendo esta notifica� por estar em desacordo com a pol�ca
de uso de celulares vigente da XXXXX, no Brasil. O gasto mensal do seu
celular est�cima do previsto pela pol�ca. Sugerimos que abra um chamado
no help desk (8080) para que possamos adequar seus planos de voz e /ou dados
�ua necessidade.
some graphic accents are missing, not the "�" but all the others are.
Should be:
Voc� est� recebendo esta notifica��o por estar em desacordo com a pol�tica de uso de celulares vigente da XXXX, no Brasil.
It is showing in the Inbox of the user:
Voc�st�ecebendo esta notifica� por estar em desacordo com a pol�ca de uso de celulares vigente da XXXXX, no Brasil.
The R$ is loaded with the rest of the script. Don't worry about it.
Wow. Feels great to read your blog.Actually I was searching for the same information since many days but todayI am so lucky to land on your page. Thanks again for your hard work.