奇怪的字符新鲜WAMP安装? [英] Strange character in fresh WAMP installation?

查看:150
本文介绍了奇怪的字符新鲜WAMP安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到的奇怪的字符在我的新鲜当地WAMP安装。我刚刚从网上下载的FTP所有.php文件在线和我的本地MySQL服务器上恢复备份。这个问题只有在文本中包含发生的符号或特殊字符

I'm getting strange characters in my fresh local WAMP installation. I've just downloaded all .php files from ftp online and restored a backup on my local mysql server. The problem only happens when text contains symbols or special characters:

PHP < META HTTP-EQUIV =Content-Type的CONTENT =text / html的;字符集= UTF-8/>

MySQL的整理 latin1_swedish_ci

当然,在这个形象有一个奇怪的符号A°,其中°和€是必要的。这在Opera和Firefox都发生了。

In this image of course there is a strange symbol "°" where "°" and "€" are needed. This has happened both in Opera and Firefox.

你知道吗?感谢您的帮助,一如既往。

推荐答案

我会在这里,因为它太长了评论回答。

I'll answer here because it's too long for a comment.

您不需要更改编码,您应该查看您的编码。该编码可以在很多不同的地方进行更改需要牢记的:

You don't need to change your encoding, you should check your encoding. Keep in mind that encoding could be changed in a lot of different places:

  • In your database with charset functions
  • In your apache configuration with AddDefaultCharset
  • With php header function
  • In your html with a <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> tag

任何这些原因会导致在web浏览器中显示错误的编码。如果你不与一个或多个previous方式指定,相应的层将使用其配置的默认。

Any of these reasons could lead to wrong encoding displayed in the web browser. And if you do not specify it with one or more the previous methods, the corresponding layer will use its configured default.

在你的情况,因为文字是从数据库到来,因为经常在WAMP / XAAMP / MAMP使用MySQL的一个奇怪的默认编码,我会检查点之一。尝试执行 SET NAMES UTF-8 (或者你使用任何编码)查询 检索数据,只是你的数据库后进行连接功能之前。

In your case since the text is coming from database and since often in WAMP/XAAMP/MAMP MySQL use a weird default encoding, I'd check for point one. Try to execute SET NAMES UTF-8 (or whatever encoding you use) query before retrieving data, just after your db connect function.

这篇关于奇怪的字符新鲜WAMP安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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