New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

>From 
>https://docs.microsoft.com/en-us/windows/desktop/api/stringapiset/nf-stringapiset-multibytetowidechar:

For the code pages listed below, dwFlags must be set to 0. Otherwise, the 
function fails with ERROR_INVALID_FLAGS.

    50220
    50221
    50222
    50225
    50227
    50229
    57002 through 57011
    65000 (UTF-7)
    42 (Symbol)

But currently in PyUnicode_DecodeCodePageStateful() it is set to 
MB_ERR_INVALID_CHARS for all code pages except CP_UTF7. This causes an error 
for all other code pages list above.

>>> codecs.code_page_decode(50220, b'abc')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [WinError 1004] Invalid flags

----------
components: Interpreter Core, Windows
messages: 338067
nosy: doerwalter, lemburg, paul.moore, serhiy.storchaka, steve.dower, 
tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Invalid flag for some code page decoders
type: behavior
versions: Python 2.7, Python 3.7, Python 3.8

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

Reply via email to