此导入有什么问题?
我下载了Jython 2.7的4.4版本
import ftfy
import sys
print (ftfy.fix_encoding("н368вв777"))
Traceback (most recent call last):
File "D:/rs_al/IdeaProjects/XLStoSQL/src/main/java/BrokenUTF8.py", line 4,
in <module>
import ftfy
File "C:\jython\Lib\site-packages\ftfy\__init__.py", line 12, in <module>
from ftfy import fixes
UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 2-8:
illegal Unicode character
File "C:\jython\Lib\site-packages\ftfy\__init__.py", line 12, in <module>
from ftfy import fixes
UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 2-8: illegal Unicode character
使用Python3 + ftfy 5,一切正常,但是我考虑过使用java + jython将带有ftfy包的错误UTF8字符转换为数据并将其返回给Java。 另外,我将源的默认解码设置为UTF-8,因为当我使用jython 2.7时,源的默认解码为ascii。
答案 0 :(得分:0)
全功能ftfy仅适用于Python3。将项目移至Python。解决了