简体   繁体   中英

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. 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

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. This is, file -bi reports the files being as text/plain; charset=utf-8, so I'm stumped where ASCII comes into play.

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.

Further tests with java -jar -verbose suggests there may be something more serious that's missing, because it stops executing at:

[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

On my local machine it initializes the java.util.logging.Logger after this line, while on the server it skips past it and exits.

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]

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

-Dfile.encoding=UTF-8

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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