Question

I've been using this (https://developers.google.com/maps/articles/phpsqlajax_v3) as a guide for showing a bunch of points from a MySQL database on a map. Everything works fine, until I add the letter "ø" to the database. I think it has to do with the encoding of the XML file that's being sent from the server to the client.

My databse is set to UTF-8 ("MySQL charset: UTF-8 Unicode (utf8)"), but the XML file that is being retrieved from the server says "xml version="1.0" encoding="ISO-8859-1"". I just can't get it encoded with UTF-8 (UTF-8 should be default anyway??), something seems to be overriding it and setting it to "ISO-8859-1".

index.html includes: meta http-equiv="content-type" content="text/html; charset=UTF-8"

genxml.php includes: $dom = new DOMDocument("1.0", "UTF-8");

and: header("Content-type: text/xml;charset=UTF-8");

What am I missing here?? :/

EDIT: When I don't have any special characters in my database, the XML encoding is "UTF-8". It's only when I add the "ø", that it changes to "ISO-8859-1".

Was it helpful?

Solution

For the record, replacing the "mysql" api with "mysqli", and adding this mysqli_set_charset($connection,"utf8"); to my php solved the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top