Re: How to convert Unicode numbers into proper utf8 text?
On Wed, 18 Oct 2006 10:33:26 -0400, T wrote:
>> How to convert those unicode number(95EE, 7956, ...) into utf8 text?
>
> perl -p000e 's/\n//g; s / \[([0-9a-f]{1,4}) \?\] / chr(hex($1)) /giex;'
> ^^^^^^^^
>
> NB, if there is no the "s/\n//g", ie, removing all \n, then not all chars
> are converted, eg. [4EAB, [FF, ...
>
> If you can have OO output paragraphs in single line, then you don't need
> it.
If you can't, this make it a little bit better:
perl -p000e 's/([][0-9A-F?])\n([][0-9A-F?])/$1$2/g; s / \[([0-9a-f]{1,4}) \?\] / chr(hex($1)) /giex;' 2>/dev/null;
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/
Reply to: