Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Polskie znaki w pliku php, dodalem deklaracje polskich znakow i nic z tego
uczaj21
post
Post #1





Grupa: Zarejestrowani
Postów: 115
Pomógł: 0
Dołączył: 30.06.2007

Ostrzeżenie: (20%)
X----


Witam mam dziwny problem z kodowaniem polskich znakow.Najgorsze w tym ze deklaruje polskie znaki w meta.Jest to skrypcik losowych cytatow z pliku txt.Na przegladarce nie wyswietlaja mi sie polskie zanki albo wyswietlaja sie niektore polskie na ż a ą juz nie itp.Prosze o pomoc Zamieszczam kod ponizej dodam iz plik ma format php a nie html

  1. <html>
  2. <head>
  3. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" />
  4. <meta http-equiv="Pragma" content="no-cache" />
  5. <meta name="Author" content="Łukasz Stolarski" />
  6. <meta name="Authoring_tool" content="PHP Webpage Editor" />
  7.  
  8. </head>
  9. <?
  10.  // Quick random quote
  11.  // This script reads a quote file (flat text file), and picks one of the loaded
  12.  // quotes at random and displays it.
  13.  // Line breaks and formatting can be put into the quotefile as HTML tags
  14.  // Place the quotes.txt on your site, edit the $quotefile variable below,
  15.  // And copy and paste this code into your PHP page.
  16.  
  17.  // $delim tells this script what delimits the quotes (default is a CR/LF)
  18.  $delim = "\n";
  19.  
  20.  // $wuotefile points to the file that holds the actual quotes
  21.  $quotefile = "quotes.txt";
  22.  
  23.  $fp = fopen($quotefile, "r");
  24.  $contents = fread($fp, filesize($quotefile));
  25.  $quote_arr = explode($delim,$contents);
  26.  fclose($fp);
  27.  srand((double)microtime()*1000000);
  28.  $quote_index = (rand(1, sizeof($quote_arr)) - 1);
  29.  $herequote = $quote_arr[$quote_index];
  30.  echo $herequote;
  31. ?>
  32. </html>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
JoShiMa
post
Post #2





Grupa: Zarejestrowani
Postów: 1 374
Pomógł: 149
Dołączył: 1.03.2006

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


Żeby znaleźć przyczynę trzeba sobie odpowiedzieć na kilka pytań:
1. Skąd pochodzi ten tekst, który nie zawiera polskich znaków?
2. W jakim standardzie kodowania jest zapisany?
3. Jakie jest domyślne kodowanie ustawione w konfiguracji Apache?

Dopiero jak będziesz znał odpowiedzi na te wszystkie pytania uda CI się cokolwiek ustalić.

Ten post edytował JoShiMa 16.12.2008, 11:39:26
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 25.08.2025 - 00:03