Displaying non UTF-8 8 bit character codes with writefln()
Graham
GC
Thu Oct 4 07:26:51 PDT 2007
Is there an easy way of displaying non UTF-8 8 bit codes with writefln() ?
E.g. code like:
writefln("elapsed time %.9f \µS", elapsed_time);
On a windows system displays output like:
elapsed time 2.598202392 µS
(displayed when running in a cmd.exe window)
The µ is character codes 0xC2 0xB5 for the UTF-8 encoding
of µ.
Code like:
writefln("elapsed time %.9f \u00B5S", elapsed_time);
displays the same
and code like:
writefln("elapsed time %.9f \xB5S", elapsed_time);
understandably displays the run-time error:
Error: 4invalid UTF-8 sequence
trying a Wysiwyg string like:
writefln("elapsed time %.9f " r"µ" "S", elapsed_time);
displays a compiler error: invalid UTF-8 sequence
Is there any simple way to output a non UTF-8 string containing
the B5 character code without the C2 prefix ?
More information about the Digitalmars-d-learn
mailing list