数据库文本中的奇怪字符:Ã,Ã,¢,â,€, [英] Strange Characters in database text: Ã, Ã, ¢, â‚ €,

查看:319
本文介绍了数据库文本中的奇怪字符:Ã,Ã,¢,â,€,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这第一次发生的时间。



我有一个新的下载运营联营网站,并从批发商那里收到产品目录的导出副本。我将其格式化并导入到Prestashop 1.4.4。



网站的前端包含产品文本中的奇怪字符的组合:Ã,



这些字符存在于大约40%的数据库表中,而不是



另一个网站主题当数据库连接字符串使用不正确的字符编码类型时会出现同样的问题。



在/config/setting.inc中,没有字符编码字符串提到,只是MySQL引擎,它设置为InnoDB,它匹配我在PHPMyAdmin中看到的。



我导出ps_product_lang,替换所有实例这些字符具有正确的字符,以UTF-8格式保存CSV文件,并使用PHPMyAdmin重新导入它们,并指定UTF-8作为语言。



在PHPMyAdmin中新的搜索,现在我在ps_product_lang中的这些坏字符的实例数是我开始时的10倍。



如果问题很简单,指定正确语言属性在数据库连接字符串中,其中/我如何设置这个,什么?偶然,我试着在 -on-websites-ascii-unicode>这个线程,但问题仍然是:

  SET NAMES utf8 

UPDATE :PHPMyAdmin说:


MySQL字符集:UTF-8 Unicode(utf8)


这是我在上一个导入文件中使用的字符集,这导致更多的字符损坏。在导入过程中,将UTF-8指定为导入文件的字符集。



UPDATE2



以下是一个示例:


人们真正的生活untetheredÃÆ'Ã,¢ÃƒÂ¢Ã¢â,â ¡Ã,¬ƒƒƒ¯Ã¢â,¬
Ã,ï†在线购买和租借电影,下载软件和
在网络上共享和存储文件。


UPDATE3



我在PHPMyAdmin中运行了一个SQL命令, set:




  • character_set_client utf8

  • character_set_connection utf8

  • character_set_database latin1

  • character_set_filesystem binary

  • character_set_results utf8

  • character_set_server latin1

  • character_set_system utf8



因此,我的数据库可能需要转换(或删除并重新创建)为UTF-8。如果MySQL服务器是latin1,这可能会造成一个问题?



MySQL能否将服务内容翻译为UTF8,但将其存储为latin1?我不认为它可以,因为UTF8是latin1的超集。我的网站托管支持在48小时内没有回复。对他们来说太难了。

解决方案

如果表的字符集与内容相同,请尝试使用 mysql_set_charset('UTF8',$ link_identifier) code> 。请注意,MySQL使用 UTF8 指定UTF-8编码,而不是 UTF-8 这是更常见的。



检查我的其他回答一个类似的问题。


I'm not certain when this first occured.

I have a new drop-shipping affiliate website, and receive an exported copy of the product catalog from the wholesaler. I format and import this into Prestashop 1.4.4.

The front end of the website contains combinations of strange characters inside product text: Ã, Ã, ¢, â‚ etc. They appear in place of common characters like , - : etc.

These characters are present in about 40% of the database tables, not just product specific tables like ps_product_lang.

Another website thread says this same problem occurs when the database connection string uses an incorrect character encoding type.

In /config/setting.inc, there is no character encoding string mentioned, just the MySQL Engine, which is set to InnoDB, which matches what I see in PHPMyAdmin.

I exported ps_product_lang, replaced all instances of these characters with correct characters, saved the CSV file in UTF-8 format, and reimported them using PHPMyAdmin, specifying UTF-8 as the language.

However, after doing a new search in PHPMyAdmin, I now have about 10 times as many instances of these bad characters in ps_product_lang than I started with.

If the problem is as simple as specifying the correct language attribute in the database connection string, where/how do I set this, and what to?

Incidently, I tried running this command in PHPMyAdmin mentioned in this thread, but the problem remains:

SET NAMES utf8

UPDATE: PHPMyAdmin says:

MySQL charset: UTF-8 Unicode (utf8)

This is the same character set I used in the last import file, which caused more character corruptions. UTF-8 was specified as the charset of the import file during the import process.

UPDATE2

Here is a sample:

people are truly living untetheredÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬ÃƒÂ¯Ã¢â‚¬Â Ã‚ï† buying and renting movies online, downloading software, and sharing and storing files on the web.

UPDATE3

I ran an SQL command in PHPMyAdmin to display the character sets:

  • character_set_client utf8
  • character_set_connection utf8
  • character_set_database latin1
  • character_set_filesystem binary
  • character_set_results utf8
  • character_set_server latin1
  • character_set_system utf8

So, perhaps my database needs to be converted (or deleted and recreated) to UTF-8. Could this pose a problem if the MySQL server is latin1?

Can MySQL handle the translation of serving content as UTF8 but storing it as latin1? I don't think it can, as UTF8 is a superset of latin1. My web hosting support has not replied in 48 hours. Might be too hard for them.

解决方案

If the charset of the tables is the same as it's content try to use mysql_set_charset('UTF8', $link_identifier). Note that MySQL uses UTF8 to specify the UTF-8 encoding instead of UTF-8 which is more common.

Check my other answer on a similar question too.

这篇关于数据库文本中的奇怪字符:Ã,Ã,¢,â,€,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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