Reply to [PHP 4.3.7] $_POST accented characters

Your name:

Reply:


Posted by pf on 01/09/05 10:41

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация