Page 1 of 2

Enabling Special Characters in Windows 10

Posted: 28 Jul 2021 11:40
by atfon
This one might be a quick no, given the limitations I'm including. :wink: I had a question about the display of special characters in Windows 10. I've seen from JEB, T3RRY and others how to set a variable to initialize Console Virtual Terminal Sequences in Windows 10 with something like this:

Code: Select all

for /F "delims=#" %%e in ('"prompt #$E# & for %%e in (1) do rem"') do set "\e=%%e"
I know I can then toggle between DEC Line Drawing Mode and ASCII Mode with something like this:

Code: Select all

REM DEC Line Drawing Mode
echo %\e%(0
REM ASCII Mode
echo %\e%(B
Are we then just limited to this DEC Special Graphics Character set?

https://vt100.net/docs/vt220-rm/table2-4.html

Are there any other characters which can be used without adjusting either the encoding of the batch file or the code page of the computer system?

Locale name: en-US
Code Pages: OEM 437
ANSI 1252

Re: Enabling Special Characters in Windows 10

Posted: 28 Jul 2021 12:25
by ShadowThief
That's all there is, but which characters you have access to will vary based on whether you use the command prompt or the Windows Terminal.

The only letters that work with both are f, g, j, k, l, m, n, q, t, u, v, w, x, y, and z.

Re: Enabling Special Characters in Windows 10

Posted: 28 Jul 2021 12:39
by atfon
Thanks, ShadowThief. I'm interested specifically in the Terminal here. I haven't had any issues using [`], [a] as well as the ones you mentioned. It'll be interesting to see where all this goes in the next major update to Windows 10 (Windows 11).

Re: Enabling Special Characters in Windows 10

Posted: 29 Jul 2021 23:06
by T3RRY
atfon wrote:
28 Jul 2021 12:39
Thanks, ShadowThief. I'm interested specifically in the Terminal here. I haven't had any issues using [`], [a] as well as the ones you mentioned. It'll be interesting to see where all this goes in the next major update to Windows 10 (Windows 11).
There are a few undocumented characters. The below is the complete list for command prompt.

Code: Select all

@Echo off & Cls
 For /f %%e in ('Echo Prompt $E^|cmd')Do Set "\E=%%e"

rem output:          ▒ ° ± ┘ ┐ ┌ └ ┼ ─ ├ ┤ ┴ ┬ │ ≤ ≥ · ♦ ≠ π £
 <nul Set /p "=%\E%(0a f g j k l m n q t u v w x y z ~ ` | { }%\E%(B%\E%[2E"
 <nul set /p "=a f g j k l m n q t u v w x y z ~ ` | { }%\E%[E"
Pause
Given the focus is now on windows terminal, I'd consider it extremely unlikely command prompt will recieve any attention from the microsoft development team.

Re: Enabling Special Characters in Windows 10

Posted: 30 Jul 2021 06:59
by ShadowThief
T3RRY wrote:
29 Jul 2021 23:06
atfon wrote:
28 Jul 2021 12:39
Thanks, ShadowThief. I'm interested specifically in the Terminal here. I haven't had any issues using [`], [a] as well as the ones you mentioned. It'll be interesting to see where all this goes in the next major update to Windows 10 (Windows 11).
There are a few undocumented characters. The below is the complete list for command prompt.

Code: Select all

@Echo off & Cls
 For /f %%e in ('Echo Prompt $E^|cmd')Do Set "\E=%%e"

rem output:          ▒ ° ± ┘ ┐ ┌ └ ┼ ─ ├ ┤ ┴ ┬ │ ≤ ≥ · ♦ ≠ π £
 <nul Set /p "=%\E%(0a f g j k l m n q t u v w x y z ~ ` | { }%\E%(B%\E%[2E"
 <nul set /p "=a f g j k l m n q t u v w x y z ~ ` | { }%\E%[E"
Pause
Given the focus is now on windows terminal, I'd consider it extremely unlikely command prompt will recieve any attention from the microsoft development team.
If you're like me and wondered why some of the characters weren't appearing, make sure the font you're using supports them all. I had to switch from Cascadia Mono to Consolas to get the ▒ to appear.

Re: Enabling Special Characters in Windows 10

Posted: 30 Jul 2021 08:09
by atfon
If you're like me and wondered why some of the characters weren't appearing, make sure the font you're using supports them all. I had to switch from Cascadia Mono to Consolas to get the ▒ to appear.
That's a good point. I was already set to Consolas and had no issues. I don't know if this is possible through batch commands, but it would be nice to be able to toggle the terminal font based on the characters you need.

Re: Enabling Special Characters in Windows 10

Posted: 30 Jul 2021 08:19
by ShadowThief
atfon wrote:
30 Jul 2021 08:09
If you're like me and wondered why some of the characters weren't appearing, make sure the font you're using supports them all. I had to switch from Cascadia Mono to Consolas to get the ▒ to appear.
That's a good point. I was already set to Consolas and had no issues. I don't know if this is possible through batch commands, but it would be nice to be able to toggle the terminal font based on the characters you need.
In terms of setting fonts, the most consistent way I've found to do it is to create a shortcut to the script and set the font in the shortcut.

Re: Enabling Special Characters in Windows 10

Posted: 30 Jul 2021 08:49
by atfon
In terms of setting fonts, the most consistent way I've found to do it is to create a shortcut to the script and set the font in the shortcut.
True, but it would be handy to be able to swap on the fly as the script is running.

Re: Enabling Special Characters in Windows 10

Posted: 31 Jul 2021 17:25
by aGerman
it would be handy to be able to swap on the fly as the script is running
This might help: viewtopic.php?f=3&t=10156

Steffen

Re: Enabling Special Characters in Windows 10

Posted: 02 Aug 2021 07:06
by atfon
Hi Steffen,

That looks really interesting. I will work with the tool you created. Thanks for posting that. I know a number of us have been looking for a solution for doing this for a long time. On a lighter note, did you ever consider DasTips for your handle? Would DosItHelp be jealous of the pun? :lol: :wink:

Thanks again for all your work!

Re: Enabling Special Characters in Windows 10

Posted: 02 Aug 2021 11:13
by aGerman
I'm afraid you need to enlighten me on your pun. It might be obvious to a native speaker, but unfortunately not to me :lol:
FWIW I personally find DosTips confusing enough. Certainly doesn't help to separate DOS (operating system) from Windows Batch (scripting language). This forum is way more about the latter :wink:

Steffen

Re: Enabling Special Characters in Windows 10

Posted: 02 Aug 2021 11:19
by atfon
I was combining the German word "Das" with the English word "Tips" in that the letters are very similar to the domain name of this site. Not that funny, I know. :)
I agree with you about this forum being far more about command line and batch scripting than the old Disk Operating System.

Re: Enabling Special Characters in Windows 10

Posted: 02 Aug 2021 11:35
by aGerman
It didn't even occur to me that this was a German word :oops: ("Das" is a singular article while Tips is plural which is the reason why I didn't see the relation.)
Besides of that, the founder of DosTips has German roots. I don't think he would be jealous :lol:

Steffen

Re: Enabling Special Characters in Windows 10

Posted: 02 Aug 2021 13:26
by atfon
...which is the reason why I didn't see the relation.
Which is also why it was intended to be a rather silly "pun." :)
...the founder of DosTips has German roots.
Cool. I didn't know that. Nice to learn a little something about the history of this forum.

Re: Enabling Special Characters in Windows 10

Posted: 17 Sep 2021 07:42
by atfon
I found another way (native to Windows Vista and above) to use extended ASCII from this forum post: viewtopic.php?t=3857
So, I can use code like this to capture the character and display it:

Code: Select all

for /f "delims= " %%g in ('forfiles /p "." /m "%~nx0" /c "cmd /c echo(0xcb"') do set "CB=%%g"
echo %CB%