[issue37532] email.header.make_header() doesn't work if any `ascii` code is out of range(128)

2019-08-01 Thread Yun Li


Yun Li  added the comment:

Hi, David:

I don't think your argument stands here. The whole world does not just
include English speaking countries. There are Spanish, Russian, Chinese,
etc. Any legacy packages should support all languages instead of just
English. This is definitely a bug in this package. I hope that the python
support team should fix this issue or simply add the "support English only"
description in the function explicitly . Otherwise it is very annoying for
other countries to use this package.

Thanks!
Yun

On Thu, Aug 1, 2019 at 5:42 AM R. David Murray 
wrote:

>
> R. David Murray  added the comment:
>
> The input header is not valid (non-ascii is not allowed in headers), so
> you shouldn't expect make_header to do anything sensible.  Note that this
> is the legacy API, which is a toolkit and does not hold your hand when it
> comes to RFC compliance.  Aside from any other concerns, this is long
> standing behavior (it is the same in python2), and it doesn't make sense to
> change the behavior of a legacy API.
>
> --
> resolution:  -> not a bug
> stage: patch review -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> <https://bugs.python.org/issue37532>
> ___
>

--

___
Python tracker 
<https://bugs.python.org/issue37532>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37532] email.header.make_header() doesn't work if any `ascii` code is out of range(128)

2019-07-09 Thread Yun Li

New submission from Yun Li :

email.header.make_header() doesn't work if any `ascii` code is out of range(128)

For example 

>>> header = "Your booking at Voyager Int'l 
>>> Hostel,=?UTF-8?B?IFBhbmFtw6EgQ2l0eQ==?=,   Panamá- Casco Antiguo"

>>> decode_header(header)
[(b"Your booking at Voyager Int'l Hostel,", None), (b' Panam\xc3\xa1 City', 
'utf-8'), (b',   Panam\xe1- Casco Antiguo', None)]

>>> make_header(decode_header(header))
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/email/header.py",
 line 174, in make_header
h.append(s, charset)
  File 
"/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/email/header.py",
 line 295, in append
s = s.decode(input_charset, errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 9: ordinal 
not in range(128)

--
components: email
messages: 347577
nosy: barry, r.david.murray, yunlee
priority: normal
severity: normal
status: open
title: email.header.make_header() doesn't work if any `ascii` code is out of 
range(128)
type: behavior
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue37532>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com