We are moving our web application from Apache 2.0 to IIS 7.

Everyhing is fine with UTF-8 encoding, but just one thing.

There's a flash movie in the page that reads an xml content (dynamically generated by php) which if served by Apache correctly displays french-specific characters (èé, for example), while if the same content is served by IIS 7 those characters are screwed up.

"Hm, server encoding", I thought.

Well I put in my script the line

header('Content-Type: text/xml; charset=utf-8');

before anything else; the XML content is correctly quoted with UTF-8 encoding:

$str = '<?xml version="1.0" encoding="UTF-8"?>';

and the encoding of underlying MySQL database and tables is utf8-general-ci.

After that nothing changes: characters like èé are still screwed up if the XML is served through apache.

What am I doing wrong?

  • 1
    Have you compared phpinfo() on both servers to make sure they're identical? Are you testing the XML output with something like Fiddler as you make changes rather than a browser to ensure that you're not running into browser issues like caching? Are there any differences in the Flash object parameters? You may get a better response to this on Server Fault, but it's a bit of a mish mosh of potential problems. :S
    – JasonBirch
    Commented Oct 21, 2010 at 9:25

1 Answer 1


We had the same problem with XML generated with Classic asp.. The workaround that worked best for us was to create a custom HTTP handler for XML files...

Its something you can do in your web.config file:

  <remove name="ASPClassic" />
  <add name="XMLasASPClassic" path="*.xml" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="File" requireAccess="Script" />
  <add name="ASPClassic" path="*.asp" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="File" requireAccess="Script" />

essentially what it does is treat .xml files as .asp files. meaning that <% %> and all asp code works in them. The good thing is FLash still sees this as standard xml and your visitors cannot figure out what you are using to create the xml files dynamically.

Also make sure you test your script first by making sure flash can support an actual xml file...

I am sure you can use the above approach with PHP... StackOverflow may have some more info on that...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.