Question mark characters displaying within text, w

2019-01-12 02:23发布

I have a backup server that automatically backs up my live site, both files and database.

On the live site, the text looks fine, but when you view the mirrored version of it, it displays '?' within some of the text. This text is stored within the news database table.

Here is a screen shot of it being on the live server and of it on the mirrored server.

What could happen within the process of backing it up to the mirrored server? alt text http://i34.tinypic.com/2mpbfo6.jpg

8条回答
可以哭但决不认输i
2楼-- · 2019-01-12 03:05

I got here looking for a solution for JavaScript displayed in the browser and although not directly related with a database...

In my case I copied and pasted some text I found on the internet into a JavaScript file and saved it with Windows Notepad.

When the page that uses that JavaScript file output the strings there were question marks (like the ones shown in the question) instead of the special characters like accented letters, etc.

I opened the file using Notepad++. Right after opening the file I saw that the character encoding was set as ANSI as you can see (mouse cursor on footer) in the following screenshot:

enter image description here

To solve the issue, click the Encoding menu in Notepad++ and select Encode in UTF-8. You should be good to go. :)

查看更多
不美不萌又怎样
3楼-- · 2019-01-12 03:08

Edit your Apache configuration file on the "mirror" server (the server with the problem), and comment-out the following line:

AddDefaultCharset UTF-8

Then restart Apache:

service httpd restart

The problem is that the "AddDefaultCharset UTF-8" line overrides the Content-Type specified in the .html files; e.g.:

<meta http-equiv=Content-Type content="text/html; charset=windows-1252">

The most common symptom is that character codes above 127 display as black diamonds with question marks on them (in Chrome, Safari or Firefox), or as little boxes (in IE and Opera). HTML files generated by Microsoft Word usually have many such characters, the most common one being character code 160 = 0xA0, which is equivalent to "&nbsp;" in the Windows-1252 encoding, and is often found between span tags, like this:

<span style="mso-spacerun: yes">ááá </span>
查看更多
登录 后发表回答