On Thu, Apr 11, 2002 at 12:04:18AM -0700, Pedro Ferreira wrote:
> I already have a perl script (thanks to Oyvind A.
> Holm) that converts an ascii file with U+nnnn unicode
> codes to an utf-8 file.
> Now I would like to do the oposite, convert an utf-8
> file to an ascii file, each utf-8 character would be
> encoded back to U+nnnn. Many thanks in advance for any
> help!

  Just like in the case of the opposite conversion, this conversion can also
be easily achieved with an one-liner. The following seems to be able to do
the job:

  perl -ne 'for (unpack "U*", $_) { printf $_ > 255 ? "U+%04X" : "%c", $_ }'

-- 
Vasilis Vasaitis
[EMAIL PROTECTED]

"Don't do drugs. Santa Claus is watching."
                -- winamp.com


--
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/linux-utf8/

Reply via email to