How to replace � in a string

前端 未结 10 597
挽巷
挽巷 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:33

    Character issues like this are difficult to diagnose because information is easily lost through misinterpretation of characters via application bugs, misconfiguration, cut'n'paste, etc.

    As I (and apparently others) see it, you've pasted three characters:

    codepoint   glyph   escaped    windows-1252    info
    =======================================================================
    U+00ef      ï       \u00ef     ef,             LATIN_1_SUPPLEMENT, LOWERCASE_LETTER
    U+00bf      ¿       \u00bf     bf,             LATIN_1_SUPPLEMENT, OTHER_PUNCTUATION
    U+00bd      ½       \u00bd     bd,             LATIN_1_SUPPLEMENT, OTHER_NUMBER
    

    To identify the character, download and run the program from this page. Paste your character into the text field and select the glyph mode; paste the report into your question. It'll help people identify the problematic character.

提交回复
热议问题