php - What does \\x80-\\xFF refer to? -


in process of looking solutions sanitise output, came across code following.

preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $some_url) 

now, think it's trying remove other above mentioned characters. doesn't \\x80-\\xff refer form of non-printable ascii characters ? if so, why code possibly trying not remove them ?

any indications/pointers/help appreciated. thanks.

okay, answers given far lead me in right direction , allowed me find following in documentation.

after \x, 2 hexadecimal digits read (letters can in upper or lower case). in utf-8 mode, \x{...} allowed, contents of braces string of hexadecimal digits. interpreted utf-8 character code number given hexadecimal number. original hexadecimal escape sequence, \xhh, matches two-byte utf-8 character if value greater 127.

so, summary :-

i) '\x' allows hexadecimal escape sequence, after which, 2 hexadecimal digits read

ii) '\xhh' 2 'hh' letters can in upper or lower case

iii) '\xhh' specifies code-point in range 0-ff

iv) '\x80-\xff' refers character range outside ascii


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -