Hi everybody

my application at -- ht
tp://www.maps.beechhillcommunity.org.uk/WQD/district.php

will only work for some of the records in the MySQL db (East Devon works) - 
on others it fails giving an XML Parsing Error -

"<b>Warning</b>:  DOMElement::setAttribute() [<a 
href='domelement.setattribute'>domelement.setattribute</a>]: string is not in 
UTF-8 in <b>/home/beechhil/public_html/maps/WQD/title_genxml.php</b> on line 
<b>67</b><br /><br /><b>Warning</b>:  DOMDocument::saveXML() [<a 
href='domdocument.savexml'>domdocument.savexml</a>]: output conversion failed 
due to conv error, bytes 0x96 0x20 0x54 0x68 in 
<b>/home/beechhil/public_html/maps/WQD/title_genxml.php</b> on line 
<b>81</b><br /><?xml version="1.0" encoding="ISO-8859-1"?><markers><marker 
FirstName="Henry" LastName="Willi....."

My code is based on the example at -- 
http://code.google.com/apis/maps/articles/phpsqlsearch_v3.html#outputxml

On another page http://www.maps.beechhillcommunity.org.uk/WQD/writer.php  (or 
rather the genxml.php behind it)
I have tried to add some php to encode the $results into utf-8 but it fails...

"....
$result = mysql_query($query);

$num_rows = mysql_num_rows($result);

echo $num_rows;

// Put results in array
for($i = 0; $array[$i] = mysql_fetch_assoc($result); $i++) ;
   
// force utf-8 encoding
function convertArrayKeysToUtf8(array $result) {
    $convertedArray = array();
    foreach($array as $key => $value) {
      if(!mb_check_encoding($key, 'UTF-8')) $key = utf8_encode($key);
      if(is_array($value)) $value = $this->convertArrayKeysToUtf8($value);

      $convertedArray[$key] = $value;
    }
    return $convertedArray;
  } 
  
convertArrayKeysToUtf8($convertedArray);

header("Content-type: text/xml");

// Iterate through the rows, adding XML nodes for each
while ($row = @mysql_fetch_assoc($convertedArray)){
  $node = $dom->createElement("marker");
  $newnode = $parnode->appendChild($node);
  $newnode->setAttribute("LastName", $row['LastName']);
....."

I've been going crazy with this, I'm new to php and coding in general and very 
pleased to have got this far. I just need some way to get around/over the 
encoding problem. Any help gratefully received
Gazza




-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to