Skip to content
  • Sergey Torokhov's avatar
    cltostring.py: force using utf8 · 7f851dc7
    Sergey Torokhov authored
    In some cases [1] (maybe due to user locale ussies) the system env codepage
    could differ from utf8. As some of .cl files contains non-ascii symbold
    e.g authora names the cltostring.py script then fails to convert .cl file
    to header file with the error message like:
    
    "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 783:
    ordinal not in range(128)"
    
    This patch resolves such issues by forcing utf8 codepage while reading .cl.
    The resulting cltostring.py script is compatible both python2.7 and python3.x.
    
    When python2.7 support will be dropped the addition of
    'from __future__ import unicode_literals', 'import io'
    and 'io.' could be removed as not neccessary for python3.x.
    
    [1] https://bugs.gentoo.org/705286
    7f851dc7