There is a piece of JSON
{
"Content": "The first time I sent it, my aunt came to see me, but my husband was not honest, holding me and touching it... finally, I reached out to the following... I opened it and asked him what he was doing... he blinked innocently: I see if my aunt's bed is good... ",
}
There is no error in Java, but in other places such
Http://jsonlint.com/
JSON parsing error reported here
Let's take a look at the above text. There is an invisible control character between "Me And ke ".
Write a method to replace these control characters.
Public static string filtercontrolascii (string Str ){
Stringbuilder sb = new stringbuilder ();
Int SZ = Str. Length ();
For (INT I = 0; I <SZ; I ++ ){
If (charutils. isasciicontrol (Str. charat (I) = false ){
SB. append (Str. charat (I ));
}
}
Return sb. tostring ();
}
That's all.