简体   繁体   English

编码错误-不可编码的ASCII字符

[英]Encoding error - unmappable character for encoding ASCII

I'm having some trouble compiling the ZXing source code on a headless Ubuntu 16.04 server, while at home on Ubuntu 18.04 (non-headless) it compiles just fine. 我在无头的Ubuntu 16.04服务器上编译ZXing源代码时遇到了一些麻烦,而在Ubuntu 18.04(无头)家用计算机上,它的编译就很好了。 I've tinkered around with locales, making sure they're identical, though it doesn't fix the errors like there: 我修改了语言环境,确保它们相同,尽管它不能解决此处的错误:

[ERROR] /root/zxing/core/src/main/java/com/google/zxing/client/result/WifiResultParser.java:36: error: unmappable character for encoding ASCII [错误] /root/zxing/core/src/main/java/com/google/zxing/client/result/WifiResultParser.java:36:错误:不可编码的ASCII字符

Having gone through setup-locale and other few attempts with LC_ALL I just don't understand what the issue may be, and changing the original code is the least favorable option. 在使用LC_ALL进行设置区域设置和其他几次尝试后,我只是不了解问题可能是什么,因此更改原始代码是最不利的选择。 This is, file -bi reports the files being as text/plain; 这是,file -bi报告文件为文本/纯文本; charset=utf-8, so I'm stumped where ASCII comes into play. charset = utf-8,所以我很困惑ASCII发挥作用的地方。

For now I can do with mvn package -Dmaven.test.skip=true -Dmaven.javadoc.skip=true but that's just a workaround, not a solution. 现在,我可以使用mvn软件包-Dmaven.test.skip = true -Dmaven.javadoc.skip = true进行操作,但这只是一种解决方法,而不是解决方案。

Further tests with java -jar -verbose suggests there may be something more serious that's missing, because it stops executing at: 使用java -jar -verbose进行的进一步测试表明,可能缺少一些更严重的东西,因为它在以下位置停止执行:

[6.979s][info][classload] java.time.Instant source: jrt:/java.base [6.980s][info][classload] java.time.Clock source: jrt:/java.base [6.980s][info][classload] java.time.Clock$SystemClock source: jrt:/java.base [6.982s][info][classload] java.time.ZoneId source: jrt:/java.base [6.982s][info][classload] java.time.ZoneOffset source: jrt:/java.base [6.979s] [info] [classload] java.time.Instant源:jrt:/java.base [6.980s] [info] [classload] java.time.Clock源:jrt:/java.base [6.980s] [info] [classload] java.time.Clock $ SystemClock源:jrt:/java.base [6.982s] [info] [classload] java.time.ZoneId源:jrt:/java.base [6.982s] [info ] [classload] java.time.ZoneOffset来源:jrt:/java.base

On my local machine it initializes the java.util.logging.Logger after this line, while on the server it skips past it and exits. 在我的本地计算机上,它在此行之后初始化java.util.logging.Logger,而在服务器上,它跳过并退出。

Further inspection shows that it fails to read the image I'm giving to it stopping at: [Dynamic-linking native method com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage ... JNI] [Dynamic-linking native method com.sun.imageio.plugins.jpeg.JPEGImageReader.disposeReader ... JNI] [Dynamic-linking native method java.io.FileInputStream.close0 ... JNI] 进一步的检查显示它无法读取我给它的图像,该图像停止在:[动态链接本机方法com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage ... JNI] [动态链接本机方法com .sun.imageio.plugins.jpeg.JPEGImageReader.disposeReader ... JNI] [动态链接本机方法java.io.FileInputStream.close0 ... JNI]

这是由于默认编码,而不是必需的 UTF-8,请尝试以下操作:

-Dfile.encoding=UTF-8

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM