16

I have .properties files with a bunch of unicode escaped characters. I want to convert it to the correct chars display.

E.g.:

Currently: \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u005c
Desired result: все готово

Notepad++ is already set to encode UTF8 without BOM. Opening the document and 'converting' (from the Encoding drop-down menu) doesn't do anything.

How do I achieve this with notepad++?

If not in Notepad++, is there any other way to do this for many files, perhaps by using some script?

tome
  • 1,136
  • 2
  • 8
  • 25

2 Answers2

29

You need a plugin named HTML Tag. Once plugin is installed, select your text and invoke command Plugins > HTML Tag > Decode JS (Ctrl+Shift+J).

Dmitriy Konovalov
  • 1,777
  • 14
  • 14
  • 2
    I tried this plugin (version 1.1) but it crashed with notepad++ version v7.7.1 x64 on Windows 10 x64 while decoding "\u0061\u003e". The notepad++ process simply crashed. Are you aware of any alternatives to achieve just Unicode encode/decode in notepad++? – shashi Apr 03 '20 at 11:59
  • The problem described by @shashi seems to be solved by now. – this.myself Aug 08 '23 at 11:39
3

I'm not aware of how you can do it natively in Notepad++ but as requested you can script it with Python:

import codecs

# opens a file and converts input to true Unicode
with codecs.open("escaped-unicode.txt", "rb", "unicode_escape") as my_input:
    contents = my_input.read()
    # type(contents) = unicode 

# opens a file with UTF-8 encoding
with codecs.open("utf8-out.txt", "wb", "utf8") as my_output:
    my_output.write(contents)
Jan
  • 1,032
  • 11
  • 26
Alastair McCormack
  • 26,573
  • 8
  • 77
  • 100