How do you print UTF-8 symbols and characters?

If you have any questions, remarks, ... if you need help... its here...

How do you print UTF-8 symbols and characters?

Postby bobgillies » 08 Feb 2017 00:53

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?
bobgillies
 
Posts: 60
Joined: 24 Jan 2017 06:26

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

Postby Franck » 08 Feb 2017 14:00

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
Franck
 
Posts: 140
Joined: 29 Oct 2014 19:01

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

Postby bobgillies » 08 Feb 2017 15:14

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
bobgillies
 
Posts: 60
Joined: 24 Jan 2017 06:26


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron