Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'mailman.': 0.03; '(at': 0.04; 'encoding': 0.05; 'class,': 0.07; 'modifying': 0.07; 'aliases': 0.09; 'broke': 0.09; 'mailman': 0.10; 'cc:addr:python- list': 0.11; 'python': 0.11; 'def': 0.12; 'skip:= 70': 0.12; "'euc_jp':": 0.16; "'euc_kr':": 0.16; 'campus,': 0.16; 'charset': 0.16; 'cleaner': 0.16; 'dict': 0.16; 'least)': 0.16; 'm.sc.': 0.16; '\xc3\xa9crit\xc2\xa0:': 0.16; 'wrote:': 0.18; 'basically': 0.19; 'solution.': 0.20; 'seems': 0.21; '>>>': 0.22; 'input': 0.22; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; '>>>': 0.24; 'skip:e 30': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; '>': 0.26; 'pass': 0.26; 'subject:/': 0.26; 'somewhere': 0.26; 'header:In-Reply-To:1': 0.27; 'character': 0.29; 'patch': 0.29; 'wonder': 0.29; 'dec': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; "skip:' 10": 0.31; 'apparently': 0.31; 'names.': 0.31; 'produces': 0.31; 'servers.': 0.31; 'file': 0.32; 'skip:c 30': 0.32; 'url:python': 0.33; 'received:74.125.82': 0.34; 'could': 0.34; 'problem': 0.35; 'subject:with': 0.35; 'except': 0.35; 'problem.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'building': 0.35; 'really': 0.36; '14,': 0.36; 'url:listinfo': 0.36; 'method': 0.36; 'thanks': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'should': 0.36; 'changing': 0.37; 'skip:& 10': 0.38; 'handle': 0.38; 'files': 0.38; 'pm,': 0.38; 'skip:& 20': 0.39; 'received:74.125': 0.39; 'does': 0.39; '(from': 0.39; 'university': 0.39; 'users': 0.40; 'url:mail': 0.40; 'skip:\xc2 10': 0.60; 'affect': 0.61; 'e-mail:': 0.61; 'simply': 0.61; 'exchange': 0.63; 'name': 0.63; 'more': 0.64; 'tel.:': 0.65; 'wall': 0.65; 'to:addr:gmail.com': 0.65; 'mar': 0.68; 'invalid': 0.68; 'caused': 0.69; '8bit%:100': 0.72; '2014,': 0.84; 'dict.': 0.84; 'played': 0.84 X-Gm-Message-State: ALoCoQkokuomNZ/JJkj2V6zwE07qOTehqG5AvxLgTQDHkYCqfdD25LCmhrZhVshAOAq9M9+cQFsh X-Received: by 10.180.74.212 with SMTP id w20mr4068482wiv.22.1418642849935; Mon, 15 Dec 2014 03:27:29 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <65c6d3c8-33cd-4fe9-a37e-cf2c1744603b@googlegroups.com> References: <6ed57daf-29ec-4b45-b8b6-233d8d14cc02@googlegroups.com> <65c6d3c8-33cd-4fe9-a37e-cf2c1744603b@googlegroups.com> From: Stefanos Karasavvidis Date: Mon, 15 Dec 2014 13:27:09 +0200 Subject: Re: encoding name mappings in codecs.py with email/charset.py To: gst Content-Type: multipart/alternative; boundary="f46d043c7eb82244a8050a3f8734" X-Originating-IP: [74.125.82.47] Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 433 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418642854 news.xs4all.nl 2855 [2001:888:2000:d::a6]:32848 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82559 --f46d043c7eb82244a8050a3f8734 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I played around with changing the names in the aliases.py and locale.py files (from iso8859 to iso-88559), but this broke mailman. I ended up changing the charset.py file input_charset =3D codecs.lookup(input_charset).name except LookupError: pass if (input_charset =3D=3D 'iso8859-7'): input_charset =3D 'iso-8859-15 if (input_charset =3D=3D 'iso8859-15'): input_charset =3D 'iso-8859-7' if (input_charset =3D=3D 'iso8859-1'): input_charset =3D 'iso-8859-1' This seems to work for now. I really wonder why I'm the only one with this problem. This should affect all Mailman users with member on MS Exchange 2010 (at least) servers. Exchange produces CAT.InvalidContent.Exception: InvalidCharsetException, Character set name (iso8859-7) is invalid or not installed.; cannot handle content of message with... Thanks gst for the input sk On Sun, Dec 14, 2014 at 9:53 PM, gst wrote: > > Le dimanche 14 d=C3=A9cembre 2014 14:10:22 UTC-5, Stefanos Karasavvidis a > =C3=A9crit : > > thanks for replying gst. > > > > I've thought already of patching the Charset class, but hoped for a > cleaner solution. > > > > > > This ALIASES dict has already all the iso names *with* a dash. So it > must get striped somewhere else. > > > not on my side, modifying this dict with the missing key-value apparently > does what you want also : > > Python 2.7.6 (default, Mar 22 2014, 22:59:56) > [GCC 4.8.2] on linux2 > Type "copyright", "credits" or "license()" for more information. > >>> > >>> import email.charset > >>> email.charset.ALIASES > {'latin-8': 'iso-8859-14', 'latin-9': 'iso-8859-15', 'latin-2': > 'iso-8859-2', 'latin-3': 'iso-8859-3', 'latin-1': 'iso-8859-1', 'latin-6'= : > 'iso-8859-10', 'latin-7': 'iso-8859-13', 'latin-4': 'iso-8859-4', > 'latin-5': 'iso-8859-9', 'euc_jp': 'euc-jp', 'latin-10': 'iso-8859-16', > 'ascii': 'us-ascii', 'latin_10': 'iso-8859-16', 'latin_1': 'iso-8859-1', > 'latin_2': 'iso-8859-2', 'latin_3': 'iso-8859-3', 'latin_4': 'iso-8859-4'= , > 'latin_5': 'iso-8859-9', 'latin_6': 'iso-8859-10', 'latin_7': > 'iso-8859-13', 'latin_8': 'iso-8859-14', 'latin_9': 'iso-8859-15', 'cp949= ': > 'ks_c_5601-1987', 'euc_kr': 'euc-kr'} > >>> > >>> for i in range(1, 16): > c =3D 'iso-8859-' + str(i) > email.charset.ALIASES[c] =3D c > > > >>> > >>> iso7 =3D email.charset.Charset('iso-8859-7') > >>> iso7 > iso-8859-7 > >>> str(iso7) > 'iso-8859-7' > >>> > > regards, > > gst. > > > > > sk > > > > > > > > On Sun, Dec 14, 2014 at 7:21 PM, gst wrote: > > Le vendredi 12 d=C3=A9cembre 2014 04:21:14 UTC-5, Stefanos Karasavvidis= a > =C3=A9crit : > > > > > I've hit a wall with mailman which seems to be caused by pyhon's > character encoding names. > > > > > > > > > > I've narrowed the problem down to the email/charset.py file. Basicall= y > the following happens: > > > > > > > > > > > > > Hi, > > > > > > > > it's all in the email.charset.ALIASES dict. > > > > > > > > you could also simply patch the __str__ method of Charset : > > > > > > > > Python 2.7.6 (default, Mar 22 2014, 22:59:56) > > > > [GCC 4.8.2] on linux2 > > > > Type "copyright", "credits" or "license()" for more information. > > > > >>> > > > > >>> import email.charset > > > > >>> > > > > >>> c =3D email.charset.Charset('iso-8859-7') > > > > >>> str(c) > > > > 'iso8859-7' > > > > >>> > > > > >>> old =3D email.charset.Charset.__str__ > > > > >>> > > > > >>> def patched(self): > > > > r =3D old(self) > > > > if r.startswith('iso'): > > > > return 'iso-' + r[3:] > > > > return r > > > > > > > > >>> > > > > >>> email.charset.Charset.__str__ =3D patched > > > > >>> > > > > >>> str(c) > > > > 'iso-8859-7' > > > > >>> > > > > > > > > > > > > regards, > > > > > > > > gst. > > > > -- > > > > https://mail.python.org/mailman/listinfo/python-list > > > > > > > > > > -- > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > Stefanos Karasavvidis, Electronic & Computer Engineer, M.Sc. > > e-mail: s...@isc.tuc.gr, Tel.: (+30) 2821037508, Fax: (+30) 2821037520 > > Technical University of Crete, Campus, Building A1 > -- > https://mail.python.org/mailman/listinfo/python-list > --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Stefanos Karasavvidis, Electronic & Computer Engineer, M.Sc. e-mail: sk@isc.tuc.gr, Tel.: (+30) 2821037508, Fax: (+30) 2821037520 Technical University of Crete, Campus, Building A1 --f46d043c7eb82244a8050a3f8734 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I played around with changing the names in = the aliases.py and locale.py files (from iso8859 to iso-88559), but this br= oke mailman.

I ended up changing the charset.py file

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 input_charset =3D codecs.lookup(input_charse= t).name
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 except LookupError:
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pass
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 if (input_charset =3D=3D 'iso8859-7'):
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 input_charset = =3D 'iso-8859-15
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (inpu= t_charset =3D=3D 'iso8859-15'):
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 input_charset =3D 'iso-8859-7'=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (input_charset =3D=3D = 9;iso8859-1'):
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 input_charset =3D 'iso-8859-1'


Thi= s seems to work for now.

I really wonder why I'm the only one w= ith this problem. This should affect all Mailman users with member on MS Ex= change 2010 (at least) servers. Exchange produces
CAT.InvalidContent.Exc= eption: InvalidCharsetException, Character set name (iso8859-7) is invalid = or not installed.; cannot handle content of message with...
<= /div>

Thanks gst for the input

sk

On Sun, Dec 14, 2014 a= t 9:53 PM, gst <g.starck@gmail.com> wrote:
Le dimanche 14 d=C3=A9cembre 2014 14:10:22 UTC-5, Stefanos Ka= rasavvidis a =C3=A9crit=C2=A0:
> thanks for replying gst.
>
> I've thought already of patching the Charset class, but hoped for = a cleaner solution.
>
>
> This ALIASES dict has already all the iso names *with* a dash. So it m= ust get striped somewhere else.


not on my side, modifying this dict with the missing key-value appar= ently does what you want also :

Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "copyright", "credits" or "license()" fo= r more information.
>>>
>>> import email.charset
>>> email.charset.ALIASES
{'latin-8': 'iso-8859-14', 'latin-9': 'iso-8859= -15', 'latin-2': 'iso-8859-2', 'latin-3': '= iso-8859-3', 'latin-1': 'iso-8859-1', 'latin-6'= : 'iso-8859-10', 'latin-7': 'iso-8859-13', 'lat= in-4': 'iso-8859-4', 'latin-5': 'iso-8859-9', &= #39;euc_jp': 'euc-jp', 'latin-10': 'iso-8859-16'= ;, 'ascii': 'us-ascii', 'latin_10': 'iso-8859-1= 6', 'latin_1': 'iso-8859-1', 'latin_2': 'is= o-8859-2', 'latin_3': 'iso-8859-3', 'latin_4': = 'iso-8859-4', 'latin_5': 'iso-8859-9', 'latin_6= ': 'iso-8859-10', 'latin_7': 'iso-8859-13', = 9;latin_8': 'iso-8859-14', 'latin_9': 'iso-8859-15&= #39;, 'cp949': 'ks_c_5601-1987', 'euc_kr': 'euc= -kr'}
>>>
>>> for i in range(1, 16):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 c =3D 'iso-8859-' + str(i)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 email.charset.ALIASES[c] =3D c


>>>
>>> iso7 =3D email.charset.Charset('iso-8859-7')
>>> iso7
iso-8859-7
>>> str(iso7)
'iso-8859-7'
>>>

regards,

gst.

>
> sk
>
>
>
> On Sun, Dec 14, 2014 at 7:21 PM, gst <g.st...@gmail.com> wrote:
> Le vendredi 12 d=C3=A9cembre 2014 04:21:14 UTC-5, Stefanos Karasavvidi= s a =C3=A9crit=C2=A0:
>
> > I've hit a wall with mailman which seems to be caused by pyho= n's character encoding names.
>
> >
>
> > I've narrowed the problem down to the email/charset.py file. = Basically the following happens:
>
> >
>
>
>
> Hi,
>
>
>
> it's all in the email.charset.ALIASES dict.
>
>
>
> you could also simply patch the __str__ method of Charset :
>
>
>
> Python 2.7.6 (default, Mar 22 2014, 22:59:56)
>
> [GCC 4.8.2] on linux2
>
> Type "copyright", "credits" or "license()&quo= t; for more information.
>
> >>>
>
> >>> import email.charset
>
> >>>
>
> >>> c =3D email.charset.Charset('iso-8859-7')
>
> >>> str(c)
>
> 'iso8859-7'
>
> >>>
>
> >>> old =3D email.charset.Charset.__str__
>
> >>>
>
> >>> def patched(self):
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 r =3D old(self)
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if r.startswith('iso'):
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 'is= o-' + r[3:]
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return r
>
>
>
> >>>
>
> >>> email.charset.Charset.__str__ =3D patched
>
> >>>
>
> >>> str(c)
>
> 'iso-8859-7'
>
> >>>
>
>
>
>
>
> regards,
>
>
>
> gst.
>
> --
>
> https://mail.python.org/mailman/listinfo/python-list
>
>
>
>
> --
>
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Stefanos Karasavvidis,=C2=A0 Electronic & Computer Engineer, M.Sc.=
> e-mail: s...@isc.tuc.gr,= Tel.: (+3= 0) 2821037508, Fax: (+30) 2821037520
> Technical University of Crete,= Campus, Building A1
--
https://mail.python.org/mailman/listinfo/python-list


--
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Stefanos Karasavvidis,=C2=A0 Electronic & Computer Engineer, = M.Sc.
e-mail: sk@isc.tuc.gr, Tel.: (+30) = 2821037508, Fax: (= +30) 2821037520
Techn= ical University of Crete, Campus
, Building A1

--f46d043c7eb82244a8050a3f8734--