Currently my database doesn't support utf8mb4 characters. I have to replace those characters with "?".
Asked
Active
Viewed 961 times
0
-
1Possible duplicate of [JDBC url for MySQL configuration to use utf8 character encoding](http://stackoverflow.com/questions/18058297/jdbc-url-for-mysql-configuration-to-use-utf8-character-encoding) – Dr.jacky Feb 16 '16 at 04:32
-
See [Detecting a utf8mb4 charset requirement](http://stackoverflow.com/questions/21465439/detecting-a-utf8mb4-charset-requirement) – Feb 16 '16 at 04:34
-
I need regex to replace those characters in java. – Jobi Subramunian Feb 23 '16 at 03:38
1 Answers
2
String in="your input string";
in.replaceAll("[^\\u0000-\\uD7FF\\uE000-\\uFFFF]", "?")

Jobi Subramunian
- 136
- 7