Displaying non UTF-8 8 bit character codes with writefln()
Regan Heath
regan at netmail.co.nz
Thu Oct 4 07:48:03 PDT 2007
Try printf and saving the file as a UTF-8 encoded text file...
--[b5.d]--
import std.stdio;
void main()
{
printf("\µ\n");
printf("\u00B5\n");
printf("\xB5\n"); //doesn't output anything
writefln("µ");
}
Using this source saved as b5.d as a UTF-8 encoded text file (IMPORTANT)
I can set my command prompt font to "Lucida Console" and execute the
following commands:
E:\D\src\tmp>chcp 65001
Active code page: 65001
E:\D\src\tmp>dmd -run b5.d
µ
µ
µ
The 3rd printf doesn't output anything, not sure why, the others all
output the same character.
chcp 65001 changes to UTF-8 code page :)
Regan
More information about the Digitalmars-d-learn
mailing list