网页上的奇怪字符

发布于 2024-10-06 21:07:52 字数 128 浏览 0 评论 0原文

我从 Amazon Web 服务获取产品描述并将其存储在 MySQL 中。我注意到,对于某些字符,数据库中存储的内容与网页上显示的内容不同。例如,连字符 - 显示为 -。知道出了什么问题吗?

I'm getting product descriptions from Amazon web service and storing them in MySQL. I've noticed that, for some characters, what is stored in the database is not the same as what is displayed on my webpage. For example, the hyphen - is showing as —. Any idea what is wrong?

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

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

发布评论

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

评论(3

记忆消瘦 2024-10-13 21:07:52

看起来您正在存储 UTF 并以其他方式(例如 latin-1)读取。 (UTF-8 中的一个字符可以用多个字节进行编码。)

Looks like you're storing UTF and reading as something else like latin-1. (A character in UTF-8 can be encoded in more than one byte.)

壹場煙雨 2024-10-13 21:07:52

确保您的网络服务器也使用正确的字符编码。我过去在使用 æøå (在丹麦网站上)时遇到过问题,如果服务器未设置为使用正确的字符集,仅在 html 中设置字符集是不够的。

Make sure that your webserver is using the right char encoding too. I had problems in the past with æøå (on danish websites) and just setting a charset in the html isn't enough if the server isn't set to use the right charset.

不打扰别人 2024-10-13 21:07:52

我认为您应该尝试在 html 部分中添加以下代码:

并阅读一些有关UTF-8 也值得。

I think you should try adding the following code in your html <head> section:

<meta charset="utf-8" />

And reading a bit about UTF-8 is worth too.

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