the instance. The default mysql connection character set is latin-1 (Classic 5c problem ):Copy codeThe Code is as follows:$ Db = mysql_connect ('localhost: 100', 'root', '123 ');Mysql_select_db ("test ");$ A = "\ x91 \ x5c"; // gbk encoding for "bytes". The low byte is 5c, that is, "\" in ascii "\"Var_dump (addslashes ($ ));Var_dump (mysql_real_escape_string ($ a, $ db ));Mysql_query ("set names gbk ");Var_dump (mysql_real_escape_string ($ a, $ db ))
+ Token_offset]; System nt!_eprocess. Token "\x89\x91\xf8\x00\x00\x00"//mov[ecx+ Token_offset],edx ; Replace Current Process token---[Recover]"\x61"//Popad ; Restore register State from the Stack "\x81\xc4\x8c\x07\x00\x00"//Add ESP, 0x78c; Offset of IRP on stack "\x8b\x3c\x24"//mov EDI,DWORD PTR[ESP]; Restore the pointer to IRP "\x83\xc4\x08"//Add ESP, 0x8; Offset of Dbgprint st
Security Science reference
X9-65 Safety Standards (Labor Hygiene and Safety Standards)
X91 Basic Security Science Theory
X910 Security human styles
X911 Security Psychology
X912 Security physiology
X912.9 Security Human Machine Learning
X913 Security Systems
X913.1 Security Operations Research
X913.2 Security Information Theory
X913.3 Security Control Theory
X913.4 Security System Engineering
{X914} Security Human-Machine Learning
X915.1 Security Me
] = '\ 0 ';
// MessageBox does not support utf8, so only files can be written.
// Write the following text
// Write a text file. The BOM of utf8 is 0 xbfbbef.
Cfile;
Cfile. Open (_ T ("1.txt"), cfile: modewrite | cfile: modecreate );
// Starts with a file
Cfile. seektobegin ();
// Write the BOM, which is the same as the previous one
Cfile. Write ("\ XeF \ xbb \ xbf", 3 );
// Write content
Cfile. Write (szu8, u8len * sizeof (char ));
Cfile. Flush ();
Cfile. Close ();
, null); // same as above, to allocate space, leave a space for '\ 0'. // although utf8 is a unicode compression format, it is also a multi-byte string, therefore, char * szu8 = new char [u8len + 1] can be saved as char; // The strlen for conversion // Unicode is wcslen: widechartomultibyte (cp_utf8, null, wszstring, wcslen (wszstring), szu8, u8len, null, null); // Add '\ 0' szu8 [u8len] =' \ 0 '; // MessageBox does not support utf8. Therefore, you can only write files // write the following tex
must be dictionary
Other usage
Django is similar to UrlEncode in the following ways:
From django.utils.http Import Urlquotea = Urlquote (' pythontab Chinese net ') print a
Get the GBK code of Chinese characters
Urllib Converting strings
In fact, you can use the Urllib quote function to convert the Chinese in the URL, the Chinese to GBK encoding, the resulting encoding is the URL that conforms to the URI standard.
>>> import Urllib>>> a = "pythontab Chinese net" >>> a ' pythontab\xe4\xb8\xad\x
%c4%cd%f8
Note: The UrlEncode parameter must be dictionary
Other usage
Django is similar to UrlEncode in the following ways:
From django.utils.http Import Urlquotea = Urlquote (' pythontab Chinese net ') print a
Get the GBK code of Chinese characters
Urllib Converting strings
In fact, you can use the Urllib quote function to convert the Chinese in the URL, the Chinese to GBK encoding, the resulting encoding is the URL that conforms to the URI standard.
>>> import Urllib>>> a = "pythontab Chinese
corresponding characters in some form of encoding. Bytes can be converted to characters through the Encode () method, and characters can be converted to bytes by means of the decode () method:
IN[50]: s = "Life is short, I use Python" in[51 ": b = S.encode (' utf-8 ') in[52]: bout[52]: B ' \xe4\xba\xba\xe7\x94\x9f\xe8\x8b\xa6\xe7\ X9f\xad\xef\xbc\x8c\xe6\x88\x91\xe7\x94\xa8python ' in[53]: c = s.encode (' GB18030 ') in[54]: cout[54]: B ' \xc8\xcb\xc
Python contains the encoding inconsistency problem for Chinese strings.By looking at the encoding, you find that the encoding of the two strings is missing differently.Example:in [+]: ucontent = U ' Lijiang Travel (sz002033) #股票 # #炒股 # #财经 # #理财 # #投资 # Recommended package win shares, profit half-divided, not counting the principal, group: 46251412 'In []: ucontentOUT[44]: U ' \u4e3d\u6c5f\u65c5\u6e38 (sz002033) #\u80a1\u7968##\u7092\u80a1##\u8d22\u7ecf##\u7406\u8d22##\u6295\ U8d44#\u63a8\u8350
this current character set come from?By the way, you guessed it was mysql-> charset.Mysql_real_string in the determination of wide character set characters, according to the member variables to adopt different policies, for example, if it is UTF-8, then libmysql/ctype-utf8.c will be used.Check the instance. the default mysql connection character set is latin-1 (classic 5c problem ):
$ Db = mysql_connect ('localhost: 100', 'root', '123 ');
Mysql_select_db ("test ");
= str. encode ('gb2312') d = {'name': str} q = urllib. urlencode (d) print q
Result:
name=PythonTab%D6%D0%CE%C4%CD%F8
Note: The urlencode parameter must be a Dictionary
Other usage
Urlencode in django is similar to the following method:
From django. utils. http import urlquotea = urlquote ('pythontab Chinese net') print
Obtain the GBK encoding of Chinese characters
Urllib conversion string
In fact, you can use the quote function of urllib to convert Chinese in the URL into GBK encoding
'pythontab Chinese net' str = str. encode ('gb2312') d = {'name': str} q = urllib. urlencode (d) print q
Result:
name=PythonTab%D6%D0%CE%C4%CD%F8
Note: The urlencode parameter must be a DictionaryOther usage
Urlencode in django is similar to the following method:
From django. utils. http import urlquotea = urlquote ('pythontab Chinese net') print
Obtain the GBK encoding of Chinese charactersUrllib conversion string
In fact, you can use the quote function of urllib to convert Chinese in the URL
converted to corresponding characters in some encoding form. Bytes can be converted to characters by using the encode () method, while characters can be converted to bytes by using the decode () method:
In [50]: s = "My life is short, I use Python" In [51]: B = s. encode ('utf-8') In [52]: bOut [52]: B '\ xe4 \ xba \ xe7 \ x94 \ x9f \ xe8 \ x8b \ xa6 \ xe7 \ x9f \ xad \ xef \ xbc \ x8c \ xe6 \ x88 \ x91 \ xe7 \ x94 \ xa8Python 'In [53]: c = s. encod
mysql_real_escape_string (). The difference between this function and mysql_escape_string is that it considers the "current" character set. Where can this current character set come from?
By the way, you guessed it was mysql-> charset.
Mysql_real_string in the determination of wide character set characters, according to the member variables to adopt different policies, for example, if it is UTF-8, then libmysql/ctype-utf8.c will be used.
Check the instance. the default mysql connection characte
:
Python 2.7.3 (default, APR, 23:24:47) [MSC v.1500-bit (AMD64)] on Win32Type "Copyright", "credits" or "license ()" For more information.>>> "I am Chinese"' \xce\xd2\xca\xc7\xd6\xd0\xce\xc4 '>>> "I am Chinese". Decode ("GBK")U ' \u6211\u662f\u4e2d\u6587′>>> "I am Chinese". Decode ("GBK"). Encode ("GBK")' \xce\xd2\xca\xc7\xd6\xd0\xce\xc4 '>>> "I am Chinese". Decode ("GBK"). Encode ("UTF-8")' \xe6\x88\x91\xe6\x98\xaf\xe4\xb8\xad\xe6\x96
Python built-in class properties
__DICT__: Properties of the Class (contains a dictionary, consisting of the data properties of the Class)
__DOC__: Document string for Class
__NAME__: Class name
__MODULE__: The module where the class definition resides (the full name of the class is ' __main__.classname ', if the class is in an import module mymod, then classname.__module__ equals Mymod)
__BASES__: All parent classes of a class make up elements (containing a tuple of all
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.