I am currently facing an issue while trying to set a name field in DB using Java. As the names comes from a third party vendor, we get special characters like musical notes or smileys in the name field (e.g. )
Due to the above reason, the DB throws an exception below. org.springframework.jdbc.UncategorizedSQLException: query; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1366]; Incorrect string value: '\xF0\x9F\x8E\xB6' for column 'name'
I want to filter out such characters before setting it in the field.
Please let me know how can I handle the above via regex before setting the values.