Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am getting following exceptopn from webservices:

com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 15))

I know the reason behind this, I am getting "Control Characters" in data I want to return. And in xml CTRL-CHAR are not allowed.

I searched for the solution, and many places I found the code to remove CTRL-CHAR.

The concern is shall I end up loss of data if I remove control characters from data? I want the clean solution may encoding. Instead of removing control char.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
486 views
Welcome To Ask or Share your Answers For Others

1 Answer

I would do what OrangeDog suggest. But if you want to solve it in your code try:

replaceAll("[\x00-\x09\x11\x12\x14-\x1F\x7F]", "")

\x12 is the char.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...