views:

678

answers:

4

Hello,

I got very strange problem. I have one php website which is running in two server. One is on Apache (Linux) and second is on IIS (WIndow). Linux Server, I just run it for demo. IIS is the actual hosting that I need to host. Even with all the same code, database, in the linux server, there's no  character. But in IIS, everywhere got  characters. I checked all the meta tag, it's utf-8. In database collation is utf-8 also. In mysql database, i got those  character, but somehow, in linux, when we fetch the content from database, those  doesn't show. It just happening on IIS. Can anyone point out how can i resolve this ? Thank you.

+2  A: 

I had a similar issue a while ago, there are some useful comments and information here - it's PHP but I believe the theory would be the same:Question 386378

foxed
seems like, my question is quite hard to understanding. Yeap, what i got the problem isThose  character content are displaying everywhere when i am browsing at IIS server.But in apache (linux) server, it doesn't show any.All codes that I wrote and the content fetch from the database is totally same.
spotlightsnap
So the problem is probably that, while Apache correctly serving the content as UTF-8, IIS is serving it as something else--probably windows-1252. This is thoroughly covered in the thread that's linked to in this answer.
Alan Moore
A: 

You also need to specify UTF-8 in the HTTP headers. With PHP:

<?php
header('Content-Type: text/plain; charset=utf-8');
?>

With Apache:

AddDefaultCharset UTF-8

The Apache setting can be placed in an .htaccess file.

Álvaro G. Vicario
A: 

Try inspecting the html responses directly by using something like Fiddler or Firebug. Check to see if the responses from IIS/Apache (which should be returning exactly the same text) have:

  • Different data
  • Different headers

Pay particular attention to the Content-Type header, which should say what character encoding (utf-8, ISO/IEC 8859-1, Latin-1, etc.) the returned text is in.

vincebowdren
+1  A: 

I checked all the meta tag, it's utf-8.

The browser doesn't interpret the meta tag. It's only a fallback when no http-headers are present. Right click and select "View Page Info" to see what encoding the browser actually interprets the page in.

In database collation is utf-8 also. In mysql database

Collation is irrelevant for display of characters. The charset matters however. So does the connection charset.

troelskn