德语Umlaute在Mysql / Phpmyadmin [英] German Umlaute in Mysql/Phpmyadmin

查看:171
本文介绍了德语Umlaute在Mysql / Phpmyadmin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用UT8编码的Flex应用程序。它发送回服务器(PHP),数据写入Mysql(UT8 charset,utf8_general_ci)。我没有问题在所有写/从数据库读取Umlaute。



我只是意识到,通过查看PHPmyadmin的数据Umlaute不知何故转换为:



ö=>Ã
ü=>Ã$
等。



我说,我没有问题。奇怪的是,当我直接使用PHPmyAdmin将Umlaute写入数据库时​​,它们会正确显示。

现在我正在打印一个PDF,我需要调用ut8_decode()以显示所有值。但是,手动输入到DB(在phpmyadmin中正确显示)不会被解码。



我假设那些没有写入到UT8中的Db,


  1. )但是为什么在DB中以这种奇怪的方式显示UT8编码的值呢?
    2.)我如何使用PHPmyAdmin在UTF编码中输入数据到mysql? (我已将连接设置为ut8)。

Thx,
Martin


< class =h2_lin>解决方案

我在同一个问题上挣扎了很长时间。在连接到数据库时运行此查询,并且Web应用程序将显示phpmyadmin中显示的字符:



SET NAMES'utf8'



由于某种原因,MySQL在我的系统上设置,假设输入和输出被编码为latin1,这意味着当我发送它utf8输入它存储在数据库中不正确,但因为转换反转输出,混乱是撤消,它在浏览器中正确显示(除非使用phpmyadmin,它忠实显示)。只有当转换导致存储数据库字段中使用的字符集允许的字符时,才会出现这种情况,因此您可能会遇到错误,除非您停止上述查询时发生此转换。


I have Flex application with UT8-encoding. It is sending back to the Server (PHP), and the data gets written in to Mysql (UT8 charset, utf8_general_ci). I have no problems at all writing/reading Umlaute from/to the database.

I only realized, by looking at the data with PHPmyadmin that the Umlaute get somehow converted to:

ö => ö ü => ü etc.

As I said, I had no problems at all. The strange thing is, when I write Umlaute directly with PHPmyAdmin into the database, they are displayed correctly

Now I am printing a PDF, and I need to call ut8_decode() on all values to display them correctly. However, those entered manually into the DB (which are displayed correctly in phpmyadmin) do not get decoded.

I assume that those are not written to the Db in UT8 then, since decoding malforms them?

  1. )But why are in the first place UT8-encoded values displayed in this strange way in the DB? 2.) How can I enter data into mysql with PHPmyAdmin in UTF-encoding? (I have set the connection to ut8).

Thx, Martin

解决方案

I struggled with the same problem for a long time. Run this query as soon as you connect to the database and your web application will display characters as they appear in phpmyadmin:

SET NAMES 'utf8'

For some reason MySQL is set up on my systems to assume input and output are encoded as latin1, which means when I send it utf8 input it stores it in the database incorrectly, but because the conversion is reversed for output, the mess is undone and it displays correctly in the browser (except when using phpmyadmin, which displays it faithfully). This is only true when the conversion results in characters that are permitted by the character set used in the database field where it is stored, so you can get errors unless you stop this conversion from happening with the above query.

这篇关于德语Umlaute在Mysql / Phpmyadmin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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