Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question
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 Oct 21 '10 at 9:25
    
Thank you, I'll check out the things you suggested. –  BerserkEVA Oct 21 '10 at 12:24

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:

    <handlers>
  <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" />
</handlers>

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...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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