[PHP 4.3.7] $_POST accented characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, I've spent all night trying to make a simple form checking 
function that checks the name text field from a form.

For example: if I put Beltrán in the form, the
 ord($_POST['name_field'][5])=195 and not the spanish á=ord()225

Everything is ok if I use a variable in a test script:
$var="Beltrán";
if(preg_match("/á/", $var))
.
.
it works ok, but not if the $var variable is take from a $_POST...
so I guess something is going on with the $_POST

another thing:
strlen($_POST['name_field'])
everything goes ok if the $_POST value has no accented characters, but 
if it has, the strlen() results in 1 more, for ex "Beltrán" will 
result an strlen() of 8, not 7 (maybe this is because it uses 2 
characters to encode de accented letter).

I used setlocale(LC_ALL, "es_ES") and LC_MESSAGES with same results.
I changed html page encoding from charset=iso-8859-1 to charset=utf-8, 
the same.

I'm testing this in a Fedora C2 with php 4.3.7

any ideas, please?

Thanks a lot in advance.

H M

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux