Re: Printing unicode characters

James Richters via fpc-pascal <[email protected]>
Newsgroups gmane.comp.compilers.free-pascal.general
Organization Production Automation
Message-ID <[email protected]>
Indeed you CAN print Unicode characters, but not with the normal windows command prompt, nor with powershell, that is where the problem is, not with FreePascal.  But if you go to the Windows Store and download the free “Windows Terminal” there you can get it to work.
 
When you run the windows terminal, you get a powershell window, and ‘+’ gets you a new powershell window, but you can push the little down arrow next to the + and get a Command Prompt… there is a way to make the command prompt the default in the settings.  
 
If you run your pascal program inside the command prompt window of Windows terminal, you will find that you get full color Unicode characters.


I just tested it on Windows 10 and the following work:
   Writeln('Unicode scalar 1F496: ', #$1F496); // 💖
   Writeln('Unicode scalar 1F496: 💖');  //

This one does not work:
   Writeln('Unicode scalar 1F496: ', WideChar($1F496));  // 💖
 
Note that these only work if you do NOT use the CRT unit.

James
 
From: fpc-pascal <fpc-pascal-bounces-PD4FTy7X32k2wBtHl531yWD2FQJk+8+b@public.gmane.org> On Behalf Of Hairy Pixels via fpc-pascal
Sent: Sunday, December 1, 2024 1:14 AM
To: FPC-Pascal discussions <[email protected]>
Cc: Hairy Pixels <[email protected]>
Subject: [fpc-pascal] Printing unicode characters
 
ChatGPT is saying I can  print unicode scalars like that but i don’t see it works and no compiler warnings even. Did it make this up or did I do something wrong?
 
  Writeln('Unicode scalar 1F496: ', #$1F496); // 💖
  Writeln('Unicode scalar 1F496: ', WideChar($1F496));  // 💖


Regards,
    Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.