How to remove bad characters that are not suitable for utf8 encoding in MySQL?

前端 未结 6 653
刺人心
刺人心 2020-12-16 13:05

I have dirty data. Sometimes it contains characters like this. I use this data to make queries like

WHERE a.address IN (\'mydatahere\')

For

6条回答
  •  清酒与你
    2020-12-16 13:45

    May be this will help someone as it helped me.

    public static String removeBadChars(String s) {
      if (s == null) return null;
      StringBuilder sb = new StringBuilder();
      for(int i=0;i

提交回复
热议问题