Printing Unicode Characters in Poly / ML

How to print lowercase Greek epsilon in SML (using Poly / ML)?

I tried the following:

print "ε"; (* Error-unprintable character found in file *) print "\u03B5"; (* Error-Conversion exception (Invalid string constant) raised while converting \u03B5 to string *) 

Is it just not possible? Surely, the task of the terminal is to actually display the character, and therefore, printing the source code of the character on stdout should be possible?

+4
source share
1 answer

The control sequence Unicode \u03B5 corresponds to UTF-16.

Your terminal is probably running UTF-8 in which ε is 0xCE 0xB5. Entering them in decimal bytes:

 > print "\206\181\n"; ε 
+3
source

All Articles