Character Encoding : JSON, Java

http://stackoverflow.com/questions/17487058/how-to-solve-json-parse-bad-control-character-in-string-literal-in-this-code


GWT's JSONParser.parseStrict() doesn;'t allow control and private for use characters. So if you have input fields in your form where you take input form the user and parse it using JSON parser, make sure that you check for invalid chars as  below :

if(Character.isISOControl( c ) || c >= 0xE000 && c <= 0xF8FF ))
    //flag error


For java apps, you can use java.nio.charset.CharsetEncoder class to check if input stinrg is valid for your encoding.. use CharsetEncoder.canEncode() method.