How to replace � in a string

前端 未结 10 561
挽巷
挽巷 2020-11-28 07:50

I have a string that contains a character � I haven\'t been able to replace it correctly.

String.replace(\"�\", \"\");

doesn\'t work, d

10条回答
  •  醉梦人生
    2020-11-28 08:51

    That's the Unicode Replacement Character, \uFFFD. (info)

    Something like this should work:

    String strImport = "For some reason my �double quotes� were lost.";
    strImport = strImport.replaceAll("\uFFFD", "\"");
    

提交回复
热议问题