Some problems of addslashes
As for wide byte injection, if someone has written it, I won't write more:
Https://www.91ri.org/8611.html
Http://netsecurity.51cto.com/art/201404/435379_4.htm
For the iconv () function, I tried to write a url transcoding between utf-8 and gbk
Import os,urllibprint "" if u want change gbk to utf-8,please input gbk,so as input utf-8.input exit and exit Others make u try agin "" st= raw_input () def utf8cwgbk (st): if st== "utf-8": print "input string" url1 = raw_input () st1 = urllib.unquote (url1) st2 = st1.decode ("utf-8"). Encode ("gbk") url2 = urllib.quote (st2) print "url Code of utf-8-url compilation of gbk Code-utf-8 's Chinese character-gbk's Chinese character "" print url1 '- -', url2,'---',st1,'---' St2 os.system ('pause') if st== "gbk": print "input string" url1 = raw_input () st1 = urllib.unquote (url1) st2 = st1.decode ("gbk"). Encode ("utf-8") url2 = urllib.quote (st2) print "" url code of utf-8-url code of gbk-Chinese character of utf-8- -- the Chinese character "" print url1 "of gbk '-', url2,'---',st2,'---',st1 os.system ('pause') if st== "exit": os.system (' exit') else: print "" please try again.if u want change gbk to utf-8,please input gbk,else input utf8 " Finally input exit "" st = raw_input () utf8cwgbk (st) if _ name__== "_ _ main__": utf8cwgbk (st)