tom*_*ome 9 unicode encoding notepad++ utf-8
我有.properties文件与一堆unicode转义字符.我想将其转换为正确的字符显示.
E.g.:
Currently: \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u005c
Desired result: ??? ??????
Run Code Online (Sandbox Code Playgroud)
Notepad ++已设置为编码UTF8而不使用BOM.打开文档并"转换"(从"编码"下拉菜单中)不会执行任何操作.
如何使用notepad ++实现这一目标?
如果没有在Notepad ++中,是否有其他方法可以为许多文件执行此操作,可能是通过使用某些脚本?
Dmi*_*lov 21
您需要一个名为HTML Tag的插件.安装插件后,选择文本并调用命令插件 > HTML标记 > 解码JS(Ctrl + Shift + J).
我不知道如何在 Notepad++ 中本地执行此操作,但根据要求,您可以使用 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)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7356 次 |
| 最近记录: |