Announcement

Collapse
No announcement yet.

simplexml und utf-8 problem

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • simplexml und utf-8 problem

    hallo,

    ich versuche mit simplexml die wetter api von google zu parsen, was auch wunderbar funktioniert, doch nur wenn die sprache auf englisch eingestellt ist.
    Wenn ich die Wetterdaten auf deutsch haben möchte, bringt er mir ein fehler der so aussieht :

    Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.google.com/ig/api?hl=de&weather=providence parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xF6 0x6C 0x6B 0x74 in C:\xampp\htdocs\test.php on line 8

    Warning: simplexml_load_file() [function.simplexml-load-file]: data="SI"/></forecast_information><current_conditions><conditio n data="Teils bew in C:\xampp\htdocs\test.php on line 8

    er hat probleme mit den umlauten so wie ich es seh^^

    und der php code sieht so aus :

    PHP Code:
    $pfad 'http://www.google.com/ig/api?hl=de&weather='.$city;
        
    $xml simplexml_load_file($pfad);
        
    $information $xml->xpath("/xml_api_reply/weather/forecast_information");
        
    $current $xml->xpath("/xml_api_reply/weather/current_conditions");
        
    $forecast_list $xml->xpath("/xml_api_reply/weather/forecast_conditions"); 
    theoretisch dürfte er mir garkeine fehlermeldung bringen sondern die umlaute nur falsch anzeigen oder nicht?
    Zuletzt editiert von Octane; 11.01.2010, 13:45.
    Mein Technikblog ideebuzz.de

  • #2
    Hänge mal den Parameter &oe=utf-8 dran, also:
    PHP Code:
    $pfad 'http://www.google.com/ig/api?hl=de&weather='.$city.'&oe=utf-8'

    Comment


    • #3
      hat funktioniert...danke...

      wusste über diesen parameter nicht bescheid ;-)
      Mein Technikblog ideebuzz.de

      Comment

      Working...
      X