hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Black diamond question mark
Reply

Forum Jump

Black diamond question mark

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 07-23-2007, 08:15 AM
Indesicant Indesicant is offline
Newbie
 
Join Date: Apr 2007
Location: Denver, CO
Posts: 27

Black diamond question mark


Hi,

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?

Thanks.

__________________
Derek Keith
Indesicant Designs / Owner
http://www.indesicant.com


Reply With Quote


Sponsored Links
  #2  
Old 07-23-2007, 08:28 AM
Indesicant Indesicant is offline
Newbie
 
Join Date: Apr 2007
Location: Denver, CO
Posts: 27
Also as far as I know the servers are ubuntu linux, and the charset is UTF-8. In IE it just shows an empty square, in firefox a black diamond with a white question mark...

__________________
Derek Keith
Indesicant Designs / Owner
http://www.indesicant.com


Reply With Quote
  #3  
Old 07-23-2007, 11:14 PM
Czaries Czaries is offline
Junior Guru
 
Join Date: Aug 2001
Location: Central USA
Posts: 200
You're on the right track - It's a character-set issue. Get a tool that inspects the response headers of the server (like the Firebug extension if you're using Mozilla Firefox) to see what character set the server response is sending with the content. If the server's character-set and the HTML character set of the actual content don't match up, you will see some strange looking characters like those little black diamond squares.

__________________
InvoiceMore - Online Billing & Invoicing
phpDataMapper - Object-Oriented PHP5 Data Mapper ORM

Reply With Quote
Sponsored Links
  #4  
Old 07-25-2007, 08:48 PM
Czaries Czaries is offline
Junior Guru
 
Join Date: Aug 2001
Location: Central USA
Posts: 200
Also, I just dug up this website you will want to look at:
http://www.phpwact.org/php/i18n/charsets

__________________
InvoiceMore - Online Billing & Invoicing
phpDataMapper - Object-Oriented PHP5 Data Mapper ORM

Reply With Quote
  #5  
Old 07-25-2007, 08:58 PM
Indesicant Indesicant is offline
Newbie
 
Join Date: Apr 2007
Location: Denver, CO
Posts: 27
I appreciate the help, I haven't had a chance to look at it as I've been busy with some other various work, but as soon as I get a chance i'll try it out. You've been pretty helpful and you've given about the only sensible advice. Everyone else insists on it being the files themselves, but i'm almost positive that it's a server issue.

__________________
Derek Keith
Indesicant Designs / Owner
http://www.indesicant.com


Reply With Quote
  #6  
Old 07-26-2007, 02:57 PM
gbjbaanb gbjbaanb is offline
Retired Moderator
 
Join Date: Oct 2004
Location: Southwest UK
Posts: 1,159
moved to tech issues

__________________
Do not meddle in the affairs of Dragons, for you are crunchy and taste good.

Reply With Quote
  #7  
Old 07-26-2007, 04:57 PM
mwatkins mwatkins is offline
Web Hosting Master
 
Join Date: Nov 2001
Location: Vancouver
Posts: 2,416
Its definitely a character set issue.

See this thread where I post a quick set of things you can try, and links for learning:

http://www.webhostingtalk.com/showthread.php?t=621254

__________________
“Even those who arrange and design shrubberies are under
considerable economic stress at this period in history.”

Reply With Quote
  #8  
Old 07-28-2007, 12:08 PM
Fran2007 Fran2007 is offline
New Member
 
Join Date: Jul 2007
Posts: 1
Hi, Derek
What you're looking at is the result in the difference in what character set your browser is interpreting, versus the character set originally typed into the form, saved in the database, or saved on the page. In other words, there's a discrepency in "charset". Below, I provide a checklist that should help in most situations.

I know when I first saw the black diamond with question mark, I was using a research tool I had created, which includes a script to pull and print some lines from another site. There were sometimes numerous "Windows" special characters in the page code of other sites. When I changed my Safari browser from default (which was set at UTF-8) to Western ISO Latin 1, the text was normalized; and I could read it.

That was a short-term, immediate fix. Of course, I, like you, needed a long term, permanent solution.

It's possible, as you thought, that the "wrong signals" are being sent by the server; but you should be able to correct this if you have control of the scripts on the server. More on that below.

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:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

4. XML/XHTML: With XML pages, declare the "charset" in the opening line, like:
<?xml version="1.0" encoding="utf-8"?>
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:
<form method="post" accept-charset="utf-8">

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

Reply With Quote
  #9  
Old 10-06-2010, 04:01 AM
jstuttler jstuttler is offline
New Member
 
Join Date: Oct 2010
Posts: 1
Arrow Found a fix

I know this post is REALLY old, but this funky question mark diamond character has been driving me crazy all night. I finally found a solution to it.

First off, I was getting this character when I was uploading a tab delimited file using PHP. The file itself is from Google's Adsense reporting. Google has labelled the downloaded file as a CSV file, though it is actually a tab-delimited values file versus a comma separated values file. Anyway, I wanted to save the file to my desktop, then upload it to my web site via a PHP script and store the data in a MySQL database.

The simple fix (in PHP):

PHP Code:
  $file "path_to_file.csv";
  
$fh fopen($file'rb'); /* 'rb' is to read a binary file on a Windows system */
  
$line fread($fhfilesize($file));
  
$old = array("\n""\r\n""&#10""&#09""%09""%20""\0");
  
$new = array("""""""&nbsp; &nbsp; "","" """);
  
$l nl2br($line);
  
$l2 explode("<br />"$l);
  foreach (
$l2 as $k => $v){
    if (!empty(
$v)){
      if ((
stristr($v"D") === FALSE) && (stristr($v"T") === FALSE) && (stristr($v"A") === FALSE)){
        
$full str_replace($old$new$v);
        
$data explode("\t"trim($full));
        if (
stristr($data[0], "/")){
          
insert_adsense_line($data[0], $data[1], $data[2], $data[3], $data[4], $data[5]);
        }
      }
    }
  }
  
fclose($fh); 
I know this code is a bit sloppy, but hey, I've been up for 17 hours working on this damn thing...I will clean up my script tomorrow...

The important thing here is the $old array. In it, you will see the last string "\0". That is a zero, not a capital O. It was this character that was causing the issue. Once I replaced "\0" with "" (a blank no-character string), the funky question mark disappeared and the file is being processed as I need it to.

Additionally, I made sure that my database table is set to utf8_bin.

I hope this helps!

Reply With Quote
  #10  
Old 01-10-2012, 05:30 AM
simonalsa simonalsa is offline
New Member
 
Join Date: Jan 2012
Posts: 1
Question Nice one

Many thanks for sharing the solution




Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Black Lotus Raises $6M in Financing to Accelerate International Expansion Web Hosting News 2014-05-01 08:34:02
Black Lotus Completes $3.5 Million Funding Round Web Hosting News 2013-10-24 11:08:38
Black Lotus Grows Network Through Managed Hosting Acquisition Web Hosting News 2014-05-09 12:40:22
Black Lotus Acquires Managed Hosting Division of 8x8 Inc. for $3 Million Web Hosting News 2013-10-04 13:17:58
HostingCon 2013: The Coming Hybrid Wave - Colocation and the Cloud Web Hosting News 2013-06-21 17:12:32


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?