39

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

Sergey V.
  • 840
  • 8
  • 15
strudelkopf
  • 671
  • 1
  • 6
  • 12
  • If you see ß then the utf-8 encoded text did not get properly interpreted. If `chcp 65001` doesn't work then the only decent explanation is that whatever program you are using is changing it back. – Hans Passant Nov 13 '13 at 18:22
  • Is it possible that PHP is doing a conversion on the characters before they are output? – Mark Ransom Mar 12 '14 at 02:54

1 Answers1

35

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.

Community
  • 1
  • 1
Sergey V.
  • 840
  • 8
  • 15
  • Latest information: window version <=1709 can't use `chcp` and that's why I failed. I think this can still be used in some ways. Upvote. – Rick Jun 06 '18 at 16:27
  • I know this is 4 years later, but are there still steps missing? 1. `chcp 65001`, 2. Change font to `Lucida console`, 3. Configure app (e.g. Java: set `-Dfile.encoding=UTF-8`) 4. Still get question marks? Tested in PowerShell, cmd. Is there a font package that must be installed for Windows to display (e.g. simplified chinese characters?) properly? – tresf Aug 16 '21 at 15:15