Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Notepad++ i kodowanie plików php
Rostov
post
Post #1





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.10.2009

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


Dlaczego, mimo zaznaczonego w ustawieniach Notepad++ kodowania jako 8859-2, po otwarciu każdego pliku php w tym programie, mam zaznaczone domyślnie "Koduj w ANSI"? Za każdym razem muszę zmieniać zestaw znaków na 8859-2, bo inaczej po zapisaniu pliku mam problemy z krzaczkami :/
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Rostov
post
Post #2





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 13.10.2009

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


Może wyjaśnię o jaki kod chodzi:

Kod
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<link rel="stylesheet" href="../../../../../css/styl.css">
<meta name="keywords" content="blog, dziennik">
<title>CZARNOSZARY - dodaj komentarz</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="/index.rss">

</head>
<body style="background-image: url('../../../../../grafika/tlo.jpg');">
<br /><div align="center"><b> Zażółć gęślą jaźń </b> </div><br />
<?php
if (count($_POST))
{
   ////////// USTAWIENIA //////////
   $email = 'rostov@o2.pl';   // Adres e-mail adresata
   $subject = ' 17.07.2012 || 18:13 <=> Zażółć gęślą jaźń';   // Temat listu
   $message = '<b><br /><br />Dzięki za komentarz! Pojawi się po zatwierdzeniu przez moderatora;-)<br /> <br /><a href="../../../../../../index.htm">[strona główna]</a>';   // Komunikat
   $error = 'Wystąpił błąd podczas wysyłania formularza';   // Komunikat błędu
   $charset = 'iso-8859-2';   // Strona kodowa
   /////////////////////////////
  
   $head =
      "MIME-Version: 1.0\r\n" .
      "Content-Type: text/plain; charset=$charset\r\n" .
      "Content-Transfer-Encoding: 8bit";
   $body = '';
   foreach ($_POST as $name => $value)
   {
      if (is_array($value))
      {
         for ($i = 0; $i < count($value); $i++)
         {
            $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
         }
      }
      else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
   }
   echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
}
else
{
?>
<form action="?" method="post">
<table width="300" align="center">
<tr><td><b>Imię lub ksywa:</b></td>
<td><input type="text" name="name" value="" maxlength="80" size="30"></td>

<tr><td><b>E-mail:</b></td>
<td><input type="text" name="email" value="" maxlength="50"
size="30"></td></tr>

<tr><td><b>WWW:</b></td>
<td><input type="text" name="www" value="" maxlength="50"
size="30"></td></tr>

<tr><td><b>Komentarz:</b></td></td>
<td><textarea name="message" cols=30 rows=15></textarea></td></tr>
</table>
<input type="submit" value="Wy&#x015b;lij" border=0>

</form>
<?php
}
?>

</body>
</html>


Gdy przestawiam na "Koduj w UTF-8 (bez BOM)" pojawia mi się taka oto sieczka:

Kod
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<link rel="stylesheet" href="../../../../../css/styl.css">
<meta name="keywords" content="blog, dziennik">
<title>CZARNOSZARY - dodaj komentarz</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="/index.rss">

</head>
<body style="background-image: url('../../../../../grafika/tlo.jpg');">
<br /><div align="center"><b> Za࠳Ԧ g귬Ѡjaݱ </b> </div><br />
<?php
if (count($_POST))
{
   ////////// USTAWIENIA //////////
   $email = 'rostov@o2.pl';   // Adres e-mail adresata
   $subject = ' 17.07.2012 || 18:13 <=> Za࠳Ԧ g귬Ѡjaݱ';   // Temat listu
   $message = '<b><br /><br />Dzi묩 za komentarz! Pojawi siꡰo zatwierdzeniu przez moderatora;-)<br /> <br /><a href="../../../../../../index.htm">[strona gԳwna]</a>';   // Komunikat
   $error = 'WystҰiӠbӱd podczas wysyԡnia formularza';   // Komunikat bԪdu
   $charset = 'iso-8859-2';   // Strona kodowa
   /////////////////////////////
  
   $head =
      "MIME-Version: 1.0\r\n" .
      "Content-Type: text/plain; charset=$charset\r\n" .
      "Content-Transfer-Encoding: 8bit";
   $body = '';
   foreach ($_POST as $name => $value)
   {
      if (is_array($value))
      {
         for ($i = 0; $i < count($value); $i++)
         {
            $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
         }
      }
      else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
   }
   echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
}
else
{
?>
<form action="?" method="post">
<table width="300" align="center">
<tr><td><b>Imiꡬub ksywa:</b></td>
<td><input type="text" name="name" value="" maxlength="80" size="30"></td>

<tr><td><b>E-mail:</b></td>
<td><input type="text" name="email" value="" maxlength="50"
size="30"></td></tr>

<tr><td><b>WWW:</b></td>
<td><input type="text" name="www" value="" maxlength="50"
size="30"></td></tr>

<tr><td><b>Komentarz:</b></td></td>
<td><textarea name="message" cols=30 rows=15></textarea></td></tr>
</table>
<input type="submit" value="Wy&#x015b;lij" border=0>

</form>
<?php
}
?>

</body>
</html>
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: 8.08.2026 - 14:27