Windows 7 CMD 中的 UTF-8 [英] UTF-8 in Windows 7 CMD

查看:34
本文介绍了Windows 7 CMD 中的 UTF-8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 win7 cmd 中显示 UTF-8.目前,我正在使用标准字体,因为正如我在 mysql.exe 中看到的那样,它可以很好地处理我正在使用的字符(目前是德国变音符号ßäöüÄÖÜ").此外,使用另一种字体时,会出现相同的字符.

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.

但是我的 PHP 脚本的输出显示垃圾,例如'ß' 代表 'ß'.当我将输出通过管道传输到文件中并使用 Notepad++ 打开它时,它说编码是 UTF-8.在 php.ini 中,我将 UTF-8 设置为编码以及与 mySQL 数据库的连接,以及数据库本身的 UTF-8.

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.

在 CMD 中,我尝试将代码页设置为 65001,但没有任何变化.

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

我的 PHP 脚本也保存为 UTF-8

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

似乎在 latin1 中,我想要的字符也可以显示,而且确实有效.但是必须有一种方法可以在 UTF-8 中做到这一点吗?我无法将所有内容都转换为 latin1

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

推荐答案

这个问题已经在 Windows 命令行中的 Unicode 字符 - 如何?

您错过了一步 -> 除了从 cmd 控制台执行 chcp 65001 之外,您还需要使用 Lucida 控制台字体.

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

这篇关于Windows 7 CMD 中的 UTF-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆