I am trying to take a chunk of JSON that has strings which contain the literal characters \u009e
and I would like to convert those characters to its associated single unicode character, in this case é
.
I use curl or wget to download the json which looks like:
{ "name": "Kitsun\u00e9" }
And need to translate this in Vim to:
{ "name": "Kitsuné" }
My first thought was to use Vim's iconv, but it does not evaluate the string as a single character and just returns the input.
let code = '\u00e9'
echo iconv(code, "UTF-8", "UTF-8")
" Prints \u00e9
I want to eventually use something like
%s;\\u[0-9abcdef]*;\=iconv(submatch(0),"UTF-8", "UTF-8");g