hi everyone,
I just want to create a progress bar but these characters ▒ are not working ! please help
here is the sample code:
@echo off
echo Û
echo ±
echo °
pause
please view the attached file to see what i get
any help would be nice
graphic ascii characters not working
Moderator: DosItHelp
graphic ascii characters not working
- Attachments
-
- Captuddre.PNG (1.37 KiB) Viewed 3906 times
Re: graphic ascii characters not working
Basing on your result, i suspect your console uses codepage 850 and you saved your batch file as UTF-8.
You could either save your batch file as ANSI, or you could set your console (temporary) to display UTF-8 characters (codepage 65001) and use the characters directly.
Option "test.ansi.bat":
Option "test.utf-8.bat":
penpen
You could either save your batch file as ANSI, or you could set your console (temporary) to display UTF-8 characters (codepage 65001) and use the characters directly.
Option "test.ansi.bat":
Code: Select all
@echo off
echo Û
echo ±
echo °
pause
Code: Select all
@echo off
setlocal enableExtensions disableDelayedExpansion
:: save old codepage
for /f "tokens=*" %%a in ('chcp') do for %%b in (%%a) do set "cp=%%~nb"
>nul chcp 65001
echo █
echo ▒
echo ░
>nul chcp %cp%
pause
goto :eof
penpen
Re: graphic ascii characters not working
thanks for replaying,
will this be a problem to other people? or i have something wrong with my cmd and can you explain a bit more about: "and you saved your batch file as UTF-8."
if any misunderstanding sorry I am a Big noob when it comes to batch
will this be a problem to other people? or i have something wrong with my cmd and can you explain a bit more about: "and you saved your batch file as UTF-8."
if any misunderstanding sorry I am a Big noob when it comes to batch
Re: graphic ascii characters not working
Depending on how you share the batch-script-code with other people, there could be a problem.
If you zip your file and share your zip, then there is no problem (for other win 10 users, if you force your default codepage similar to the UTF-8 example).
If someone just copies your code and saves it to a file, then he has to ensure he/she/... uses the same encoding that you are using, so you should mention that somewhere.
There is nothing wrong with your cmd.
Just notice that different windows versions might have different default encodings for both windos and dos programs.
UTF-8 is one of multiple representations for data.
If you are using "notepad.exe", then you could choose "File" -> "Save As";
in the dialog that opens, you can choose the encoding (left of the "Save"-button).
penpen
If you zip your file and share your zip, then there is no problem (for other win 10 users, if you force your default codepage similar to the UTF-8 example).
If someone just copies your code and saves it to a file, then he has to ensure he/she/... uses the same encoding that you are using, so you should mention that somewhere.
There is nothing wrong with your cmd.
Just notice that different windows versions might have different default encodings for both windos and dos programs.
UTF-8 is one of multiple representations for data.
If you are using "notepad.exe", then you could choose "File" -> "Save As";
in the dialog that opens, you can choose the encoding (left of the "Save"-button).
penpen