I want to convert following string to an escaped String.
I am using StringEscapeUtils.escapeJava(), but it didn't escape the brackets.
For example:
val str = "(안녕하세요.)";
System.out.println(StringEscapeUtils.escapeJava(str))
Expected:
\\u0028\\uC548\\uB155\\uD558\\uC138\\uC694\\u002e\\u0029
Actual:
(\\uC548\\uB155\\uD558\\uC138\\uC694.)
I want to know the reason why it cannot convert to expected and how to convert to expected.
Sharing this:
Library for converting native2ascii and vice versa
The top answer but also this(2nd top):
Means:
StringEscapeUtilsversion/namespace/package (??)But no problem
(deleting the if-block + obsolete code (i.e. extra effort) from top answer)
(+ java updates)
We get: