Thursday, September 30, 2010

Black diamond question mark Character Sets / Character Encoding Issues

SkyHi @ Thursday, September 30, 2010
Problem:
I've come across a few of my sites on the server at my work that are showing up with Black Diamonds with question marks in them. It seems like just recently have we started having this problem, sites that have been up for a while now without these problems are now having them. What could be the cause of this so that we may look into it?



#
# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default.  To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
###comment out for geohalifax09 conflict
##AddDefaultCharset UTF-8
AddDefaultCharset UTF-8

Solution 1:

AddDefaultCharset iso-8859-1



Solution 2:
k thanks for the replies. I am using Firefox. I looked at the default Character coding is and it was Unicode UTF-8.

I switched to ISO-8859-1, Windows-1251, Windows-1252, and US-ASCII and it worked. The ISO-8859-15 and the default Unicode UTF-8 didnt work. So in the database, you change the character set how? Seems like it would be under Collation. I am using PHPMyAdmin

Edit: Ok nevermind then, I just had to change


to


Here is a checklist:
---------------------
1. TEXT FILES, SAVE AS: If you are uploading any pages to the server, you should make sure the page content is SAVED AS (option) Unicode (UTF-8, no BOM), rather than the default (probably Latin1). The UTF-8 BOM causes a lot of problems at this time (especially in PHP); so output _without_ the BOM.

2. DYNAMIC SCRIPT: script output:

PERL: Instead of the requisite line,
print "Content-type: text/html\r\n\r\n";
use the following line:
print qq|Content-type: text/html; charset="utf-8"\r\n\r\n|;

PHP: Output this header before content output:
header("Content-type: text/html; charset='utf-8'");

3. HTML: On any html pages output by a script, or by a WYSIWYG editor, or rolled by hand, add the meta tag "charset" identifier before opening the title tag. In fact, it should be the first meta tag after the head tag is opened. This method is suppose to force the browser to reparse everything if it wasn't parsing in that character set in the first place. (However, I can't validate that.) In other words, do this:





4. XML/XHTML: With XML pages, declare the "charset" in the opening line, like:

In xhtml documents, I still add in the meta tag from tip #3, above, for good measure.

5. FORM: To assist with properly encoded form input from your guests and members, use the "accept-charset" form attribute, like this:



6. DATABASE
: Finally, you may want to set your database default character set to utf-8 if you are storing utf-8 input.

Fran Corpier 



Solution 3:
don't copy and paste from Words

REFERENCES
http://www.webhostingtalk.com/showthread.php?t=621254
http://www.webhostingtalk.com/showthread.php?t=622439
http://www.phpwact.org/php/i18n/charsets