B
Ben Bullock
Hi,
I want to print a string of UTF8 encoded characters as two-character
hexadecimals.
For example I want to print Unicode 3003 as "E3 80 85".
My problem is, what format string should I use? I tried
printf ("%X ", c);
but it gives me "FFFFFFFE3" not "E3". So I tried putting some numbers after
the % but it didn't help. For example I tried
printf ("%2X ", c);
and
printf ("%2.2X ", c);
but this gave again the longer version of the string.
It would be easy to write a small routine to output two characters of hex
for each byte, but is there a way to do this using formats?
Thanks for your help.
Ben.
I want to print a string of UTF8 encoded characters as two-character
hexadecimals.
For example I want to print Unicode 3003 as "E3 80 85".
My problem is, what format string should I use? I tried
printf ("%X ", c);
but it gives me "FFFFFFFE3" not "E3". So I tried putting some numbers after
the % but it didn't help. For example I tried
printf ("%2X ", c);
and
printf ("%2.2X ", c);
but this gave again the longer version of the string.
It would be easy to write a small routine to output two characters of hex
for each byte, but is there a way to do this using formats?
Thanks for your help.
Ben.