Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Fun with Unicode

Charles Dye

Super Moderator
May
4,947
126
Staff member
This will work in a Take Command tab window, but not in a standalone console window:
Code:
function smiley=`%@if[%1. ge 0 .and. %1. le 79,%@char[0xd83d %@eval[0xde00 + %1]],%@char[0xd83d 0xde00]]`

Pass it a number from 0 to 79:

smilies.png
 
When I run in TakeCommand, I get this output:
1590790266482.png


When I run in the new Windows Terminal Preview:
1590790329586.png


And from a normal console it doesn't work regardless of which font I select.
 
Yeah, the console doesn't know anything about surrogate pairs. Technically I suppose the Windows console is using UCS-2, not UTF-16. But when you scrape those words out of the console buffer and pass them on to UTF-16-aware APIs, sometimes interesting stuff happens.
 
Back
Top