I have a string which has the value String s="D\"Souza"
Now before sending this i want to replace \" with \\u022 as a requirement. How to do this ?
    public static String escapeJS(String string) {
        String escapes[][] = new String[][]{
                {"\\", "\\\\"},
                {"\"", "\\u0022"},
                {"\n", "\\n"},
                {"\r", "\\r"},
                {"\b", "\\b"},
                {"\f", "\\f"},
                {"\t", "\\t"}
        };
        for (String[] esc : escapes) {
            string = string.replace(esc[0], esc[1]);
        }
        return string;
    }
}
But here after escaping when we pass this to a library the string we get conatins u0022 instead of quotes.
Any suggestions how to use the escaping correctly.
Note the library does not process correctly( basically a bug in it) \" and hence we try to use \\u0022
