-3

I want to convert ’ to apostrophe(') in Java.

Input: String s = "master’s degree"

It should be:

master's degree

AVM
  • 243
  • 3
  • 8
  • 10
    This is caused by reading text data with the wrong encoding. It would be better to fix the buggy code that read the string in incorrectly rather than try to patch it up after the fact. – John Kugelman Mar 18 '21 at 08:50
  • See [encoding - "’" showing on page instead of " ' " - Stack Overflow](https://stackoverflow.com/questions/2477452/%C3%A2%E2%82%AC-showing-on-page-instead-of) –  Mar 18 '21 at 09:06

1 Answers1

-3
  s =   s.replace("’","'");