UTF-8 to <U###> syntax?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

UTF-8 to <U###> syntax?

Jonathan D. Proulx
Hi,

anyone have a utility for converting from utf-8 text to the <U####>
syntax used in the locale files?

Thanks,
-Jon
Reply | Threaded
Open this post in threaded view
|

Re: UTF-8 to <U###> syntax?

Bruno Haible
Jonathan D. Proulx asked on 2007-03-23:
> anyone have a utility for converting from utf-8 text to the <U####>
> syntax used in the locale files?

The 'iconv' program from GNU libiconv [1] can do it:

  $ echo Русский |
    iconv -f UTF-8 -t ASCII --unicode-subst='<U%04X>'
  <U0420><U0443><U0441><U0441><U043A><U0438><U0439>

Bruno

[1] http://www.gnu.org/software/libiconv/