[nycphp-talk] verify unicode text exists
Marc Antony Vose
suzerain at suzerain.com
Tue Dec 16 12:15:05 EST 2003
hi there:
in my scripts, i generally do a simple little check like this if i
want to make sure something was inputted in a field, or in this case
i am looping through an array and removing any index that lacks at
least some text:
if( !ereg("[[:alnum:]]+",$desc_contents[$x]) ){
array_splice($desc_contents,$x,1);
}
anyway, that is enough for anything i want to do in english.
however, i am now dealing with some korean and bulgarian text, and
this fails, because those characters are not part of "alnum". at the
moment, i've replaced it with a check of "strlen($text)>0", but if
the text was ";@ #^&*" it would pass the test.
so, i'm interested in how people deal with this sort of situation?
i need to check that at least some valid characters (i.e., for human
readable content) were inputted into a form, or exist in some
variable, but that will work for any language in the world, when the
text in question is known to be unicode.
cheers,
--
Marc Antony Vose
http://www.suzerain.com/
They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety.
-- Benjamin Franklin
More information about the talk
mailing list