Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UTF-8 in Windows 7 CMD [duplicate]

I've tried to display UTF-8 in the win7 cmd. Currently, I'm using the standard font because as I see with the mysql.exe, it works fine with the characters I'm working with (currently the german umlauts "ßäöüÄÖÜ"). Also, with another font, the same characters appear.

But the output of my PHP script displays garbage, e.g. 'ß' for 'ß'. When I pipe the output into a file and open it up with Notepad++, it says the encoding is UTF-8. In php.ini I set UTF-8 as the encoding as well as in the connection to the mySQL database, and in the database itself UTF-8, too.

In CMD I tried so far to set the code page to 65001, but nothing changes.

edit: my PHP script is saved as UTF-8 as well

It seems with latin1, my desired characters can be displayed too and actually it works. But there has to be a way to do it in UTF-8? I can't convert everything to latin1

like image 736
strudelkopf Avatar asked Nov 13 '13 13:11

strudelkopf


People also ask

Can CMD display Unicode characters?

CMD.exe is a just one of programs which are ready to “work inside” a console (“console applications”). AFAIK, CMD has perfect support for Unicode; you can enter/output all Unicode chars when any codepage is active.

Does CMD support ASCII?

The encoding of cmd does not support non-ASCII character. (Or the deeper layer does not support non-ASCII).

How do I change Unicode in CMD?

To start it from the taskbar or anywhere else, make a shortcut (you can name it cmd. unicode.exe or whatever you like) and change its Target to C:\Windows\System32\cmd.exe /K chcp 65001 .


1 Answers

This question has been already answered in Unicode characters in Windows command line - how?

You missed one step -> you need to use Lucida console fonts in addition to executing chcp 65001 from cmd console.

like image 126
Sergey V. Avatar answered Sep 21 '22 06:09

Sergey V.