Krzysztof Wolny Krzysztof Wolny - 5 months ago 42
JSON Question

How to convert \uXXXX unicode to UTF-8 using console tools in *nix

I use

curl
to get some URL response, it's JSON response and it contains unicode-escaped national characters like
\u0144 (ń)
and
\u00f3 (ó)
.

How can I convert them to UTF-8 or any other encoding to save into file?

Answer

I found native2ascii from JDK as the best way to do it:

native2ascii -encoding UTF-8 -reverse src.txt dest.txt

Detailed description is here: http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/native2ascii.html