Fun with Unicode

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,365
83
Albuquerque, NM
prospero.unm.edu
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
 

samintz

Scott Mintz
May 20, 2008
1,475
15
Solon, OH, USA
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.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,365
83
Albuquerque, NM
prospero.unm.edu
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.