MikanPotatos
MikanPotatos

Reputation: 173

Protecting file uploads from files with U+202E

how would one detect if a user put the unicode U+202E in their file? I dont want to accept files with that character for security reasons.

Thank you very much.

Upvotes: 0

Views: 424

Answers (1)

Class
Class

Reputation: 3160

To remove:

$str = preg_replace("/[\x{202E}]+/u", "", $str);

or just check if something contains U+202E

if(preg_match("/[\x{202E}]+/u", $str)){

if you want to search all U+202A-E use [\x{202A}-\x{202E}]

Upvotes: 1

Related Questions