5

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.

Josh Lee
  • 171,072
  • 38
  • 269
  • 275
spotlightsnap
  • 1,095
  • 7
  • 21
  • 26

4 Answers4

2

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

Community
  • 1
  • 1
suitedupgeek
  • 875
  • 3
  • 10
  • 19
  • seems like, my question is quite hard to understanding. Yeap, what i got the problem is Those  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 Jan 28 '10 at 08:54
  • 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 Jan 28 '10 at 17:06
2

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 González
  • 142,137
  • 41
  • 261
  • 360
1

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
  • 115,121
  • 27
  • 131
  • 155
0

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.

Vince Bowdren
  • 8,326
  • 3
  • 31
  • 56