I have a textarea name remarks. When i enter ‘ this special character in textarea at the backend servlet I'm getting that value like ?(question mark) special character remarks============???????????????????????????????????????? and getting the below expetion
java.sql.SQLException: Incorrect string value: '\xC2\x91\xC2\x91\xC2\x91...' for column 'remarks' at row 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2818)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2157)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2460)
I tried the below regular expression but the exception is not solved.
if(remarks.matches("^[?]")){
errors.put("remarks", "Invalid remarks!");
}