Re: macros to share

Christian Ebert <[email protected]>
Newsgroups gmane.network.slrn.user
Organization Black Trash Productions <http://www.blacktrash.org/>
Message-ID <[email protected]>
Hi Jörg,

* Jörg Sommer on Friday, February 23, 2007 at 19:54:29 +0000:
> Christian Ebert <[email protected]> wrote:
>> * Jörg Sommer on Monday, February 19, 2007 at 22:45:17 +0000:
>>> I use a pure S-Lang implementation. It's simple, but it works.
>>> 
>>> http://www.minet.uni-jena.de/~joergs/jmime.sl
>> 
>> However, AFAICS, it doesn't take care of invalid/wrong charset
>> declarations (correct me if I'm wrong),
> 
> Yes, you are right.
> 
>> which annoy me a lot while reading.
>> 
>> Eg. Message-ID: <[email protected]>
>> in comp.text.tex declares iso-8859-1 for the body part, but
> 
> I don't see what you mean. This posting looks ok for me.
> http://groups.google.de/group/comp.text.tex/msg/cbd3621de614c121?dmode=source&output=gplain
> 
>> actually it's qp

sorry, was wrong here. The body part /is/ correctly declared but
the "ö" displays as "<F6>" in my utf-8 environment, when I view
the article with conv_mime(). 

> Do you know how the python module detects this?

It doesn't, but my script does. For each text part it tries to
get the content charset, and then recodes the decoded part text
from the given content charset to the current terminal encoding.
Recoding is done by 1.) decoding from content charset to unicode
(python's internal string representation) by builtin function
decode, 2.) encoding from unicode to terminal encoding by builtin
function encode. If the content charset is invalid or there are
errors in the decode step the script falls back first to a
preconfigured fallback charset ('cp1252' is a good value for
western encodings), and, if this still fails, it uses 'replace'
as error parameter for decoding to unicode.

(see
<http://www.blacktrash.org/cgi-bin/mercurial/SlrnMime/file/9a13c8ac6d32/Python/slrnplain/plainmsg.py>
lines 41--54)

The same is done for headers like suject, from, etc.

For non-mime messages I recode by calling iconv from slang
script.

AFAICS, jmime.sl works perfectly well if the charset of a part is
the same as the current terminal encoding (or ascii for that
matter), but otherwise the problem is that slrn's
replace_article() replaces the article without decoding the
replacement. -- And as I recur on external iconv already for
articles with wrong/invalid charsets (OLE!), I made my life easy
(and the script bulky) by resorting to python, even though all
this could surely be done in S-Lang using character tables etc.

c
-- 
_B A U S T E L L E N_ lesen! --->> <http://www.blacktrash.org/baustellen.html>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.