Welcome!

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

SignUp Now!

Echo unicode characters from UTF-8 Batch files?

Sep
23
0
I would like to use Unicode characters in a batch file with an ECHO command, but no matter how I choose the UnicodeOutput or UTF8 settings, I only can achieve this if the batch file is in UTF-16 (Little Endian) encoding (and perhaps not without the Byte Order Mark?), but I would like to my batch file to be in UTF-8 encoding.

While I was looking for an answer to this issue of my, I came across this post, which suggest using Iconv tool for converting the output file, and while I already have this tool on my machine, upon reading in the version history something about that TCC have "better" UTF-8 (might misunderstood something), I'm seeking a way to do this solely in TCC. Is it possible to control how a Batch file is interpreted? I would expect the Bite Order Mark would guide TCC which Unicode format to use.

I also just conducted some experiment with CHCP and the windows console, and I have absolutely no clue how things working. It is definitely doesn't work, if the terminal font's is a TrueType font, and it only works on future output, when it is a raster font. Knowing at some degree CHCP original purpose, I really shouldn't expect a coherent result though.
 
I could be mistaken, but I don't think UTF-8 is supported for batch files.
 
necropost time :)

could we do something like %@CHAR
Code:
 to output UTF-8 unicode characters?  

Then it doesn't have to be supported in the bat file, it just has to be supported by the internal echo  command. 

Generating modern output would be great!
 
Certainly you can. And note that (1) you can put more than one value in @CHAR's arguments, and (2) you can use hex values if you prefix them with 0x.

Also, UTF-8 batch files may not have been supported nine years ago -- but they are now!
 
Certainly you can. And note that (1) you can put more than one value in @CHAR's arguments, and (2) you can use hex values if you prefix them with 0x.

Also, UTF-8 batch files may not have been supported nine years ago -- but they are now!
This might be a lesson in why i shouldn't revive dead threads, hahaha.
 

Similar threads

Back
Top