use*_*142 0 python windows unicode python-behave
Python BDD框架Behave在其中有以下代码 runner.py
with open(filename) as f:
# -- FIX issue #80: exec(f.read(), globals, locals)
# try:
filename2 = os.path.relpath(filename, os.getcwd())
code = compile(f.read(), filename2, 'exec')
Run Code Online (Sandbox Code Playgroud)
如您所见,没有提供字符集open.根据其文档,locale.getpreferredencoding用于此类案件.
但在Windows上,此函数始终返回一个字节的字符集(所谓的"非字符串程序的字符集").适用于拉丁语的Windows-1252,适用于西里尔语的Windows-1251等.
因此,UTF-8 py文件总是被破坏.
我的问题是,如果想要超出1字节字符集,我如何在Windows上使用非脚本步骤定义?
| 归档时间: |
|
| 查看次数: |
356 次 |
| 最近记录: |