From: Marco Cimarosti (marco.cimarosti@essetre.it)
Date: Tue Mar 04 2003 - 13:06:40 EST
Doug Ewell wrote:
> David Oftedal <david at start dot no> wrote:
>
> > Hm yes, so I see, but I should have been more specific, I actually
> > need an app that can do this automatically, either in ansi C, Perl,
> > or a Linux binary. I need to call it from a script, so it's got to
> > happen automatically. The find-replace to add the 0x I can do, so
> > it's just a matter of converting glyphs to codes.
>
> From ANSI C, simply write:
>
> printf("0x%04X ", c);
And, assuming an Unicode implementation of Wide Char library, the conversion
program is ten lines of ANSI C:
#include <wchar.h>
void main (void)
{
wint_t c;
while ((c = getwchar()) != WEOF)
if (c >= 0x00 && c <= 0x7F)
putchar(c);
else
printf("0x%04lX ", c);
}
_ Marco
This archive was generated by hypermail 2.1.5 : Tue Mar 04 2003 - 14:01:15 EST