The exact characters that are escaped by this function are the null byte (0), newline (\n), carriage return (\r), backslash (\), single quote ('), double quote (") and substiture (SUB, or \032).
mysql_escape_string
(PHP 4 >= 4.0.3, PHP 5)
mysql_escape_string — Dodaje znaki unikowe na użytek mysql_query
Opis
$łańcuch_bez_znaków_unikowych
)
Ta funkcja wstawi znaki unikowe do
łańcuch_bez_znaków_unikowych, aby
bezpiecznym było umieszczenie go w mysql_query().
Informacja: mysql_escape_string() nie dotyczy znaków % i _. Funkcja ta działa identycznie jak mysql_real_escape_string(), z tym wyjątkiem, że mysql_real_escape_string() pobiera identyfikator połączenia i wstawia znaki unikowe zgodnie z bieżącym zestawem znaków. mysql_escape_string() nie pobiera identyfikatora połączenia i nie bierze pod uwagę bieżącego zestawu znaków.
Przykład #1 przykład użycia mysql_escape_string()
<?php
$item = "Zak's Laptop";
$escaped_item = mysql_escape_string($item);
printf ("Łańcuch ze znakami unikowymi: %s\n", $escaped_item);
?>
Powyższy przykład da następujący wynik:
Łańcuch ze znakami unikowymi: Zak\'s Laptop
Patrz także: mysql_real_escape_string(), addslashes() oraz dyrektywa magic_quotes_gpc.
it seems the function changes the character encoding of the string.
I get utf-8 encoded string and my mysql database is set to utf-8 as well.
If i just write the data to the database it works perfectly fine, if i use this function, it changes the encoding and therefore stores the wrong characters.
Seems like a bug to me.
