Page 1 of 1

How do you print UTF-8 symbols and characters?

PostPosted: 08 Feb 2017 00:53
by bobgillies
I've been trying to print the UTF-8 symbol for "hot beverage" at the REPL prompt. It's decimal 226 152 149. I'm trying to use "\uxxxx" function but I keep getting other weird symbols. How do I do format the unicode properly?

Re: How do you print UTF-8 symbols and characters?

PostPosted: 08 Feb 2017 14:00
by Franck
You mean "print UTF8 characters directly on the console" ?

If so, if you're working on Windows, input/output of UFT8 characters is a pain.
Unlike other OS, Windows console is not considered a file and there is not really charset for Unicode.

Depending on what you want to do, you can try character char page 65001, but I don't know if this will work of not.

I will try to do some tests this evening on Windows and come back.

Franck

Re: How do you print UTF-8 symbols and characters?

PostPosted: 08 Feb 2017 15:14
by bobgillies
You're right it is a pain judging from the blogs. Registry editing stuff that introduces other problems, it seems. Just a little console pretty printing I was thinking of using. It's really not that important. Please don't let it distract from the pending release oforth 1.0! :D

P.S. -- Windows Powershell might prove useful. Some info here on changing the codepage:
http://superuser.com/questions/269818/c ... e-to-utf-8

I'll check that out.

Bob