简体   繁体   中英

how to handle ascii non-printable characters in java

We have people sending non-printable \\x86 type of characters in byte array in Java and when we convert it to us-ascii string, it inserts junk character in the ascii text.

Is there a format for string/other way to handle non-printable ascii characters while converting data from formats like EBCDIC to ASCII in Java?

How would you like to handle them? Replace them with something printable (such as '?')? Remove them entirely? Some other action?

If you are in the US or "Western Europe" (UK, France, Germany), the character set probably is Windows-1252 . Single-byte charset US-ASCII covers 128 characters, single-byte charset Windwos-1252 is a superset covering all 255 characters in the byte range.

Easiest is a translation table for \€ - \ÿ. String, as some might be better replaced by several chars, say \Œ by "OE".

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