在 utf_unicode_ci 编码的 mysql 表中插入多字节(转换为 utf-8)字符串的问题

发布于 2024-10-09 19:01:23 字数 594 浏览 10 评论 0原文

http://domainsoutlook.com/sandbox/keyword/?s=http ://bhaskar.com

我的关键字密度分析器的原始示例。每个关键字都正确显示,在 unicode 转换等中没有任何问题。

现在,当我将这些单词添加到表的数据库列时,这些单词显示为混乱。

httpdomainsoutlook.com/b/site/bhaskar.com.html

例如,在此前端页面上,如果您看到有一个关键字显示为空白,但仍然在网站上出现 8 次。 (虽然数据库中它不为空)。

我已经检查过,mysql_real_escape_String没有问题...因为单词经过mysql_real_escape_String之前和之后的输出保持不变。

另一个问题是我想修复阿拉伯语的网址。它们应该显示为 /word-{单词的第一个字母}/{整个单词}.html 但它显示为 /word-{整个单词}/{单词的第一个字母}.html

我真的需要这些的答案两个问题。

http://domainsoutlook.com/sandbox/keyword/?s=http://bhaskar.com

raw example of my keyword density analyser. Every keyword shows up properly with no problems in unicode conversions etc.

Now, When I am adding these words to the database column of a table, the words show up as messed up.

http domainsoutlook.com/b/site/bhaskar.com.html

For example on this front end page if you see there is a keyword that is shown as a blank but still occurs on the website 8 times. (It isnt empty in the database though).

I have checked and there is no problem with mysql_real_escape_String...because the output stays the same before and after the word is gone through mysql_real_escape_String.

Another problem was that I wanted to fix my urls for arabic language. They should be showing up as /word-{1st letter of the word}/{whole word}.html but its showing as /word-{whole word}/{1st letter of the word}.html

I really need answers for these two questions.

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

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

发布评论

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

评论(2

拥有 2024-10-16 19:01:23

尝试在 php 脚本中为 mysql 连接设置 utf-8 字符集

mysql_connect(...)
mysql_select_db(...);
mysql_query('SET NAMES "utf8"');

Try setting utf-8 character set for mysql connection in your php script

mysql_connect(...)
mysql_select_db(...);
mysql_query('SET NAMES "utf8"');
金橙橙 2024-10-16 19:01:23

我尝试重新插入并且有效。

I tried reinserting and it worked.

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