Printing Unicode to the terminal

To print the Unicode character U+2665, i.e. :heart:, to the terminal, you must express it in UTF8:

  • Unicode code point: U+2665
  • UTF8 : \xe2\x99\xa5
Scheme] (display "\xe2\x99\xa5")

If you want to print it in an equation within a document, you must use the code point
or copying the character directly:

Scheme] (stree->tree `(equation* (document (sqrt "AAA♥BBB<#2665>CCC"))))

From your init file, both of these forms will work:

(display "\xe2\x99\xa5\n")
(display "♥\n")
2 Likes

I would link these posts (this and Printing colored text to the terminal with the ANSI Escape Codes) from the TeXmacs blog but perhaps it would be even better if you could write a short blog post (make a pull request or send it to @mgubi for publication).

1 Like

Good idea, I will write a résumé (this weekend) and send it to Massimiliano

2 Likes