Created
September 27, 2022 13:23
-
-
Save tcalmant/0b68e1343e5774f12bec0bd89933f082 to your computer and use it in GitHub Desktop.
Converts UTF-8 Java properties files into ISO-8859-1 with \u encoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
for p in pathlib.Path(".").glob("*.properties"): | |
with open(p, "r", encoding="utf-8") as fd: | |
converted = fd.read().encode("raw-unicode-escape").decode("latin1") | |
with open(p, "w", newline="\n", encoding="latin1") as fd: | |
fd.write(converted) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment