FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Rejecting Certain Non-ASCII Characters
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Rejecting Certain Non-ASCII Characters [message #181177 is a reply to message #181166] Fri, 19 April 2013 23:12 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Christoph Becker wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Christoph Becker wrote:
>>> Jim Higgins wrote:
>>>> Is there a simple way in PHP to restrict input to the ASCII Character
>>>> set, specifically hex 0x20 - 0x7E ? Or a simple way to detect
>>>> characters outside this range before committing them to the database?
>>>
>>> If you're dealing with a numeric column, you may consider checking for
>>> is_numeric().
>>
>> There are also regular expressions. Testing against '/[^\0x00-\x7F]/',
>> and rejecting anything that matches, appears to be the best approach
>> here.
>
> For a numeric column? Why not at least trim down the possibilites of
^^^^^^^^^^^^^^^^
> setting illegal values for the SQL statement?

A numeric column is *your* idea. The questions I have answered were the
ones that were *actually* asked:

| Is there a simple way in PHP to restrict input to the ASCII Character
| set, specifically hex 0x20 - 0x7E ? Or a simple way to detect
| characters outside this range before committing them to the database?

The character at US-ASCII code point 0x7E is _not_ a digit in any number
base.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(at)news(dot)demon(dot)co(dot)uk> (2004)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: googleapi problem
Next Topic: Undefined variable
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 16:43:23 GMT 2024

Total time taken to generate the page: 0.05045 seconds