[New-bugs-announce] [issue27354] SSLContext.load_verify_locations cannot handle paths on Windows which cannot be encoded using mbcs

Ilya Kulakov report at bugs.python.org
Sun Jun 19 22:32:09 EDT 2016


New submission from Ilya Kulakov:

On Windows 8.1 x64 with Python 3.5.1 I was able to reproduce the issue by attempting to load a file at "C:\Users\غازي\AppData\Local\Temp\_غازي_70e5wbxo\cacert.pem".

    locale.getdefaultlocale()
    > ('en_US', 'cp1252')

    locale.getpreferredencoding()
    > 'cp1252'

    sys.getfilesystemencoding()
    > 'mbcs'
    
    sys.getdefaultencoding()
    > 'utf-8'

    c = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)

    c.load_verify_locations(cafile=r"C:\Users\غازي\AppData\Local\Temp\_غازي_70e5wbxo\cacert.pem")
    > TypeError: cafile should be a valid filesystem path

    c.load_verify_locations(cafile=r"C:\Users\غازي\AppData\Local\Temp\_غازي_70e5wbxo\cacert.pem".encode(sys.getfilesystemencoding()))
    > UnicodeEncodeError: 'mbcs' codec can't encode characters in positions 0--1: invalid character

    c.load_verify_locations(cafile=r"C:\Users\غازي\AppData\Local\Temp\_غازي_70e5wbxo\cacert.pem".encode('utf-8'))
    > ok

----------
components: Extension Modules, Unicode, Windows
messages: 268880
nosy: Ilya.Kulakov, ezio.melotti, haypo, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: SSLContext.load_verify_locations cannot handle paths on Windows which cannot be encoded using mbcs
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27354>
_______________________________________


More information about the New-bugs-announce mailing list