Perhaps something like: if (!preg_match('/^[' . chr(0) . '-' . chr(255) . ']+$/', $input)){ die("possible hack attempt with non-ASCII input"); } And, actually, you probably want to start with a number higher than 0 to avoid all the control codes, and much lower than 255 to avoid extended ASCII or whatever... I think 127 is the highest most folks REALLY want in their data... You decide the range you want to allow, and put in the ASCII numbers you prefer. On Mon, November 20, 2006 11:20 am, Jens Meyer wrote: > Hello all! > > To add special string-conversions for an imap-client only for strings > with special chars I am looking for a function which checks if a > string > consists only standard ascii-chars. > > I "see"/googled the following solutions: > > - check for special chars (i.e. German umlauts) with preg_match() > > With this solution all other international charsets are not > recognized. > Not the best solution... > > - check if string contains only letters and some chars with > preg_match() > > In this case I must add all standard ASCII-chars to regexp. Would be > possible. > > - standard-function? > > Is there any php-function for this available which I haven't found > until > now? > > Thank you for your hints and kind regards, > > Jens > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php