Mobile app version of vmapp.org
Login or Join
Welton855

: IIS XML encoding seems to be wrong 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

@Welton855

Posted in: #ContentEncoding #Iis7 #Php #Xml

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Welton855

1 Comments

Sorted by latest first Latest Oldest Best

 

@Samaraweera270

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%system32inetsrvasp.dll" resourceType="File" requireAccess="Script" />
<add name="ASPClassic" path="*.asp" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%windir%system32inetsrvasp.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...

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme