|
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]
|