How to replace Unicode Character in Notepad++

Solution 1:

I wonder how do I search and replace unicode character xE5" with æ

Note that æ is actually Unicode 00E6 not 00E5.

Search and replace is not the right way to get the correct characters displayed.

<?xml version="1.0" encoding="utf-8"?>

The above states the encoding is utf-8 but the file is actually encoded as ANSI.

You need to convert the file correctly to UTF-8, as follows:

  1. Open Testfile.xlf

  2. File looks like:

    enter image description here

    Unicode is incorrectly displayed.

  3. Menu > Encoding > Select Encode in ANSI

    enter image description here

  4. File looks like:

    enter image description here

    Unicode is correctly displayed.

  5. Select all file contents (ctrl+a)

  6. Menu > Encoding > Select Convert to UTF-8

    enter image description here

  7. Save the File (ctrl+s)

  8. Close and reopen.

  9. File is now correctly encoded as UTF-8 and Unicode characters display correctly.


How can you see the file is actually ANSI?

The cygwin file utility shows this (before and after conversion):

DavidPostill@Hal /f/test
$ file -i Testfile*.xlf
Testfile.xlf:          application/xml; charset=iso-8859-1
TestfileConverted.xlf: application/xml; charset=utf-8

Solution 2:

If you want to remove UTF-8/unicode chars entirely, click Encoding in NPP and do the following steps, in order:

  1. Select Encode in UTF-8 (if it's currently in ANSI)
  2. Select Convert to ANSI (also under encoding)
  3. Save file

When I do that, all the UTF-8/unicode chars go away.