撇号替换为 ’在 mySQL 表中

发布于 2024-09-18 14:48:30 字数 252 浏览 5 评论 0原文

我是一个完整的 mySQL 和PHP noob,在我的表中,只要有撇号,它就会被替换为“。我搜索了一下,发现可能是因为我的表不是UTF-8,但是我将phpMyAdmin中的所有排序规则设置更改为utf8_unicode_ci,但我仍然得到“。

需要明确的是,我使用 NSURLConnection 将数据从 iPhone 应用程序发送到 PHP 脚本。在它加载的 url 中,撇号被替换为 %E2%80%99。我的服务器运行的是Linux。

感谢大家的帮助!

I'm a complete mySQL & PHP noob, and in my table, whenever there is an apostrophe, it gets replaced by ’. I've searched and found that it could be because my table is not UTF-8, but I changed all the collation settings in phpMyAdmin to utf8_unicode_ci, and I still get the ’.

To be clear, I am sending the data to a PHP script from an iPhone app using NSURLConnection. In the url it loads, the apostrophe is replaced by %E2%80%99. My server is running Linux.

Thanks for any help guys!

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

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

发布评论

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

评论(2

庆幸我还是我 2024-09-25 14:48:30

您必须在存储数据之前进行查询:

SET NAMES utf8

显然它是 5.2+ 中的 mysql_set_charset('utf8',$conn)

You have to make a query before storing data:

SET NAMES utf8.

Apparently it's mysql_set_charset('utf8',$conn) in 5.2+

从此见与不见 2024-09-25 14:48:30

撇号会被编码。您必须在 php 端使用 urldecode 对其进行解码,然后将其放入数据库中。

The apostrophe gets urlencoded. You will have to decode it using urldecode on the php side, then put it into the database.

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