How to properly block userAgent? like\ xA3\ xA9\ x09 by nginx

userAgent is as follows:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4 ) AppleWebKit/537.36\ (KHTML,  like Gecko ) \x09\x09\x09Chrome/55.0.2883.95   

Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html\xA3\xA9

try to block in nginx, the code is as follows:

if ($http_user_agent ~ "Mozilla/5.0\ \(compatible;\ Baiduspider/2.0;\ +http://www.baidu.com/search/spider.html\\\xA3\\\xA9") { 
    return 403; 
}

found no effect, how to block this kind of userAgent, or how to deal with characters like xA3xA9 x09? Thank you


this is the UserAgent of Baidu Spider, if you want the site not to be crawled.
you can configure robots.txt to reject all fetching so that these requests don't come and naturally don't have to be processed.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36df7-2c02e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36df7-2c02e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?