Ma Lin <malin...@163.com> added the comment:

Please look at these:

    >>> orig_name = "Ř"
    >>> orig_ch = orig_name.encode("cp1250") # Because why not?
    >>> orig_ch
    b'\xd8'
    >>> name = list(re.match(b"(?P<" + orig_ch + b">)", 
b"").groupdict().keys())[0]
    >>> name
    'Ø'  # '\xd8'
    >>> name == orig_name
    False
    >>> name.encode("latin-1")
    b'\xd8'
    >>> name.encode("latin-1") == orig_ch
    True

"Ř" (\u0158) --cp1250--> b'\xd8'
"Ø" (\u00d8) --latin-1--> b'\xd8'

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40980>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to