Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Kodowanie tekstu
Forum PHP.pl > Forum > Gotowe rozwiązania
dragonik
mam skrypt ktorym moge czytac pliki RSS i wypisac sobie np ostatni temat z blogu tylko ze na blog.pl pliki rss zapisywane sa w kodowaniu UTF-8 a ja na mojej stronie mam kodowanie ISO-8859-2 - czy jest jakis skrypt php ktory moglby to zmienic.. albo cokolwiek co mogloby to zmienic bo krzaczki na stronie wygladaja conajmniej brzydko.

dodane po chwili: mam funkcje utf8_decode, ale zmienia ona na ISO-8859-1 a ja chce na ISO-8859-2 .. to jak? tongue.gif
bregovic
Z utf8-decode" title="Zobacz w manualu PHP" target="_manual...
  1. <?php
  2. function utf82iso88592($tekscik) {
  3.  $tekscik = str_replace(&#092;"xC4x85\", \"ą\", $tekscik);
  4.  $tekscik = str_replace(&#092;"xC4x84\", 'Ą', $tekscik);
  5.  $tekscik = str_replace(&#092;"xC4x87\", 'ć', $tekscik);
  6.  $tekscik = str_replace(&#092;"xC4x86\", 'Ć', $tekscik);
  7.  $tekscik = str_replace(&#092;"xC4x99\", 'ę', $tekscik);
  8.  $tekscik = str_replace(&#092;"xC4x98\", '', $tekscik);
  9.  $tekscik = str_replace(&#092;"xC5x82\", 'ł', $tekscik);
  10.  $tekscik = str_replace(&#092;"xC5x81\", 'Ł', $tekscik);
  11.  $tekscik = str_replace(&#092;"xC5x84\", 'ń', $tekscik);  
  12.  $tekscik = str_replace(&#092;"xC5x83\", 'Ń', $tekscik);
  13.  $tekscik = str_replace(&#092;"xC3xB3\", 'ó', $tekscik);
  14.  $tekscik = str_replace(&#092;"xC3x93\", 'Ó', $tekscik);
  15.  $tekscik = str_replace(&#092;"xC5x9B\", 'ś', $tekscik);
  16.  $tekscik = str_replace(&#092;"xC5x9A\", 'Ś', $tekscik);
  17.  $tekscik = str_replace(&#092;"xC5xBC\", 'ż', $tekscik);
  18.  $tekscik = str_replace(&#092;"xC5xBB\", 'Ż', $tekscik);
  19.  $tekscik = str_replace(&#092;"xC5xBA\", 'ź', $tekscik);
  20.  $tekscik = str_replace(&#092;"xC5xB9\", 'Ź', $tekscik);
  21.  return $tekscik;
  22. } // utf82iso88592
  23.  
  24. function iso885922utf8($tekscik) {
  25.  $tekscik = str_replace(&#092;"ą\", \"xC4x85\", $tekscik);
  26.  $tekscik = str_replace('Ą', &#092;"xC4x84\", $tekscik);
  27.  $tekscik = str_replace('ć', &#092;"xC4x87\", $tekscik);
  28.  $tekscik = str_replace('Ć', &#092;"xC4x86\", $tekscik);
  29.  $tekscik = str_replace('ę', &#092;"xC4x99\", $tekscik);
  30.  $tekscik = str_replace('', &#092;"xC4x98\", $tekscik);
  31.  $tekscik = str_replace('ł', &#092;"xC5x82\", $tekscik);
  32.  $tekscik = str_replace('Ł', &#092;"xC5x81\", $tekscik);
  33.  $tekscik = str_replace('ń', &#092;"xC5x84\", $tekscik);
  34.  $tekscik = str_replace('Ń',&#092;"xC5x83\", $tekscik);
  35.  $tekscik = str_replace('ó', &#092;"xC3xB3\", $tekscik);
  36.  $tekscik = str_replace('Ó', &#092;"xC3x93\", $tekscik);
  37.  $tekscik = str_replace('ś', &#092;"xC5x9B\", $tekscik);
  38.  $tekscik = str_replace('Ś', &#092;"xC5x9A\", $tekscik);
  39.  $tekscik = str_replace('ż', &#092;"xC5xBC\", $tekscik);
  40.  $tekscik = str_replace('Ż', &#092;"xC5xBB\", $tekscik);
  41.  $tekscik = str_replace('ź', &#092;"xC5xBA\", $tekscik);
  42.  $tekscik = str_replace('Ź', &#092;"xC5xB9\", $tekscik);  
  43.  return $tekscik;
  44. } // iso885922utf8
  45. ?>
dragonik
Dzieki! Podziałało smile.gif
rachwal
Ja bym tam uzyl ICONV'a (no chyba, ze na sevie nie ma :/ ).
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.