sean finney on 18 Sep 2004 18:55:02 -0000


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

Re: [PLUG] charset encodings


hi jeff,

have you looked at the perl Encode::* libraries?  i think that might
do what you want in a more generalizable way...

	sean

On Fri, Sep 17, 2004 at 11:35:57AM -0400, Jeff Abrahamson wrote:
> On Fri, Sep 17, 2004 at 06:17:01AM -0400, Jeff Abrahamson wrote:
> > So I really think that what I want is a program that translates the
> > *contents* of my email correctly for the locale in which my terminal
> > emulator is set.
> 
> The attached kludge translates those codes that I regularly see into
> iso-8859-1 codes that my terminal emulator understands.  The encoding
> appears to be the same as the way subject lines and To/Cc/From lines
> are encoded, which is an important consideration.
> 
> -- 
>  Jeff
> 
>  Jeff Abrahamson  <http://www.purple.com/jeff/>    +1 215/837-2287
>  GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B
> 
>  A cool book of games, highly worth checking out:
>  http://www.amazon.com/exec/obidos/ASIN/1931686963/purple-20

> #!/bin/sh
> 
> BLUE="\033[0;34m\]"
> RED="\033[0;31m\]"
> PURPLE="\033[0;35m\]"
> BLACK="\033[0;30m\]"
> 
> x=/tmp/mutt-view$$.txt
> #echo $RED
> tee $x | wc | awk '{printf("  [%d lines, %d words, %d characters]",$1,$2,$3);}'
> perl -e '{print "  Top characters:";}' < /dev/null
> frequency 8 < $x
> #echo $BLACK
> echo
> echo
> cat $x | perl -pwe 's/\303\250/\350/g;  # UTF-8 e-grave
>                     s/\303\251/\351/g;  # UTF-8 e-acute
>                     s/\303\247/\347/g;  # UTF-8 c-cedilla, upper-case=\307
>                     s/\303\240/\340/g;  # UTF-8 a-grave
>                     s/\342\202\254/E/g;  # UTF-8 euro symbol ?
>                     s/\303\273/\373/g;  # UTF-8 u-circumflex
>                     s/\303\252/\352/g;  # UTF-8 e-circumflex ?
>                     s/\205/.../g;
>                     s/\201\201\201\275/oe/g;
>                     s/\201\201\201\342\200\223/---/g;  # em-dash
>                     s/\225/=>/g;  # bullet?
>                     s/[\223\224]/"/g;
>                     s/[\226\227]/--/g;
>                     s/\201\201\201\262/"/g;
>                     s/\201\201\201\263/"/g;
>                     '| \
>     perl -pwe "s/\222/'/g; s/\221/'/g;
>                s/\201\201\201\271/'/g;
>                s/\201\201\342\200\231/'/g;
>                "
> #cat $x
> /bin/rm -f $x
> 



Attachment: signature.asc
Description: Digital signature