Box-drawing characters in batch files...?
Posted: 04 Feb 2017 22:34
Hi all!
I'm using the "echo" command to write text both on-screen and to a text file. For aesthetic reasons, I now want to use box-characters like the ones shown at the top of the fourth column here:
http://www.tedmontgomery.com/tutorial/altchrc.html
If I copy and paste them into Notepad and try to save the file, I get a message warning that I'm using non-ANSI characters and need to change the encoding of the file. Unfortunately, it seems that batch files need to be in ANSI format to work.
But... I tried using Notepad++ and can paste and save a file with a box-character in it. The status bar shows that the file is encoded in UTF-8, but (unlike in Windows Notepad) the batch file saves and runs fine... except the box-characters echoed to the screen appear as capital accented characters. (The ones output to the text file appear fine.)
If I hold down the ALT key and type a 3-digit code (from the link above) in Notepad or Notepad++, the relevant box-character appears. If I do it in Wordpad, the accented capital letter appears. If I copy and paste that letter into the on-screen echo commands in my script, they appear "correctly" as box-characters when I execute the file.
I have to admit, I'm somewhat confused. I think it's something to do with "code pages"... but... :-/
I want to share my script with other people running other Windows versions and (maybe) different languages. How can I make sure my batch file can produce these box-characters consistently (to file and screen) on any system?
Is that possible?
I'm using the "echo" command to write text both on-screen and to a text file. For aesthetic reasons, I now want to use box-characters like the ones shown at the top of the fourth column here:
http://www.tedmontgomery.com/tutorial/altchrc.html
If I copy and paste them into Notepad and try to save the file, I get a message warning that I'm using non-ANSI characters and need to change the encoding of the file. Unfortunately, it seems that batch files need to be in ANSI format to work.
But... I tried using Notepad++ and can paste and save a file with a box-character in it. The status bar shows that the file is encoded in UTF-8, but (unlike in Windows Notepad) the batch file saves and runs fine... except the box-characters echoed to the screen appear as capital accented characters. (The ones output to the text file appear fine.)
If I hold down the ALT key and type a 3-digit code (from the link above) in Notepad or Notepad++, the relevant box-character appears. If I do it in Wordpad, the accented capital letter appears. If I copy and paste that letter into the on-screen echo commands in my script, they appear "correctly" as box-characters when I execute the file.
I have to admit, I'm somewhat confused. I think it's something to do with "code pages"... but... :-/
I want to share my script with other people running other Windows versions and (maybe) different languages. How can I make sure my batch file can produce these box-characters consistently (to file and screen) on any system?
Is that possible?