Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [xml] problem z kodowaniem
grzegorz_g
post
Post #1





Grupa: Zarejestrowani
Postów: 259
Pomógł: 0
Dołączył: 26.10.2004

Ostrzeżenie: (0%)
-----


takim skryptem , odczytuje dane z xml'a:

  1. <?php
  2. function recursive_obj2array( $obj )
  3. {
  4. $subject_array = array();
  5.  foreach ((array) $obj as $key => $var)
  6.  {
  7.  if (is_object($var))
  8.  {
  9.  if(count((array) $var) == 0)
  10.  {
  11.  $subject_array[$key] = 'NULL';
  12. }
  13. else
  14. {
  15. recursive_obj2array($var );
  16. }
  17. }
  18. else
  19. {
  20. $subject_array[$key] = $var;
  21. }
  22. }
  23. return $subject_array;
  24. }
  25.  
  26. echo '<pre>';
  27. $plik='http://www.goalserve.com/XMLSource.asp?sport=soccer&username=user1754&k=kjhg7&link=germany';
  28. $file=simplexml_load_file($plik);
  29. print_r( recursive_obj2array( $file ) );
  30. echo '</pre>';
  31. ?>


problem w tym iż w pliku xml wystąpią znaki np niemieckie znaki dialektyczne (umlaut) wtedy parser pokazuje bład:

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.goalserve.com/XMLSource.asp?spo...nk=germany:256: parser error : Input is not proper UTF-8, indicate encoding !
Bytes: 0xE4 0x74 0x74 0x65 in /var/www/web15/html/wetten/xml_parser/xslt_test.php on line 29


ja temu zaradzić questionmark.gif


--------------------
www.wettradar.com
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 12:05