MySQL 数据库中的克罗地亚变音符号 (utf-8)

发布于 2024-08-06 03:39:10 字数 505 浏览 3 评论 0原文

变音符号 http://img98.imageshack.us/img98/3383/dijakritickiznakovi.gif< /a>

因此,显示标题下面的符号应该以这种方式显示。
UTF-8 实体列在 HTML (utf-8) 标题下方(以下是列表:LINK )
最后一行显示了我的数据库中存储的内容。
数据库表的排序规则为utf8_unicode_ci
我想 db 中的符号不​​应该像我的情况那样? 从数据库加载时,它们在页面上正确显示,但它们都没有通过给定链接的 utf-8 表显示。即使我正确地看到它们,也许其他人也不会?

Diacritic signs http://img98.imageshack.us/img98/3383/dijakritickiznakovi.gif

So, symbols belows display title should be displayed that way.
UTF-8 entities are listed below HTML (utf-8) title (here is list: LINK)
And last line shows what is stored in my database.
Collation of db table is utf8_unicode_ci.
I suppose that symbols in db shouldn't be as they are in my case?
They are displaying correctly on page when loaded from database, but they all of them are not displayed by utf-8 table from given link. Even if I see them correctly maybe someone other won't?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

违心° 2024-08-13 03:39:10

设置 MySQL 表字符集是不够的 - 您还应该注意为客户端、连接和结果设置正确的字符集,默认值可能因服务器而异,从而使您的数据库不太可移植:相同的数据库内容可能是移动到另一台服务器时显示不同。

我已经将斯洛文尼亚文本存储到 MySQL 一段时间了,这对我有用:

  • 连接后要做的第一件事应该是发出“SET NAMES utf8" 查询
  • 确保您存储的字符串以 utf-8 开头:如果您是从网页表单中获取它们,确保页面是 UTF-8
  • 小心使用什么工具在线浏览/编辑数据库内容:PhpMysqlAdmin 绝对不安全。

希望这有帮助。

Setting the MySQL table charset is not enough - you should also take care to set the correct charset for the client, the connection and the results, which defaults may differ from server to server making your database less than portable: the same database content might be displayed differently moving to another server.

I've been storing slovenian text into MySQL for some time now and this is what works for me:

  • the first thing you do after connecting should be to issue a "SET NAMES utf8" query
  • make sure that the strings you're storing are utf-8 to start with: if you're taking them from a web page form make sure the page is UTF-8
  • be careful what tools do you use to browse/edit the database contents online: PhpMysqlAdmin is definitely unsafe.

Hope this helps.

肥爪爪 2024-08-13 03:39:10

您似乎正在尝试在数据库中存储 HTML 编码的字符串。不要这样做,它只会破坏您执行可靠搜索等字符串操作的能力。您应该能够将原始 UTF-8 编码字符作为字节存储在数据库中。

您没有说明您使用什么环境来读取数据库,也没有说明如何在底部获取“不正确”字符串(这是使用 ISO-8859-1 编码读取的 UTF-8 字节)。如果它们出现在您的网页中(并且您在标头和/或 标记中指定 UTF-8),那么您大概就在那里。

You appear to be trying to store HTML-encoded strings in your database. Don't do that, it will only break your ability to do string operations like searching reliably. You should be able to store raw UTF-8 encoded characters as bytes in your database.

You don't say what environment you're using to read the database or how you get the ‘incorrect’ string at the bottom (which is UTF-8 bytes read using ISO-8859-1 encoding). If they appear in your web page (and you're specifying UTF-8 in the headers and/or <meta> tag), you're presumably pretty much there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文