简体   繁体   中英

Unable to Remove non printable ASCII characters from XML

I have a XML which has some non printable ascii characters like ¢ìÂíÄ. When I try to remove it using replaceAll("([^\p{ASCII}])","") I'm getting result as Çé something like this for the non printable ascii characters. But I need to remove these characters completely.

Please anyone guide me on this Thanks in advance.

Use the replaceAll method of the String class to replace all non-printable ASCII characters with an empty string. Non-printable ASCII characters are those with ASCII code values below 32, except for 9 (tab), 10 (newline), and 13 (carriage return).

[^\x09\x0A\x0D\x20-\x7E]

try adding this regex...

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