XML file space character problem XML file
I transferred the above xml Information to mysql, and found that some values with the space key in the middle can be queried, but some cannot be queried.
For example
SELECT * FROM 'dux _ region' WHERE 'region _ name' = 'aland lslands' can be queried.
The handwritten 'United States'
SELECT * FROM 'dux _ region' WHERE 'region _ name' = 'United States' cannot find data
However, the 'United States' copied from XML can
Leading to a space character in the middle
How to solve this problem
Reply to discussion (solution)
There may be 2-byte UTF-8 white space characters
Post the base64 encoded raw XML content
The file is too large. I will post a part of it.
It's useless for you to paste it like this!
Because some special characters no longer exist after being copied, pasted, and processed by the CSDN editor
You can either paste the echo base64_encode (file_get_contents ('your xml file ');
Or put your xml file on the online storage.
Something like this?
77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxMb2NhdGlvbj4NCiAgPENvdW50cnlSZWdpb24gTmFtZT0iQWZnaGFuaXN0YW4iIENvZGU9IkFGRyI+DQogICAgPFN0YXRlID4NCiAgICAgIDxDaXR5IE5hbWU9IkhlcmF0IiBDb2RlPSJIRUEiLz4NCiAgICAgIDxDaXR5IE5hbWU9IkthYnVsIiBDb2RlPSJLQkwiLz4NCiAgICAgIDxDaXR5IE5hbWU9IkthbmRhaGFyIiBDb2RlPSJLREgiLz4NCiAgICAgIDxDaXR5IE5hbWU9Ik1hemFyLWkgU2hhcmlmIiBDb2RlPSJNWlIiLz4NCiAgICA8L1N0YXRlPg0KICA8L0NvdW50cnlSZWdpb24+DQogIDxDb3VudHJ5UmVnaW9uIE5hbWU9IkFsYW5kIGxzbGFuZHMiIENvZGU9IkFMQSIgLz4NCiAgPENvdW50cnlSZWdpb2
Http://pan.baidu.com/s/1kTCCDtd
Network disk address
Too big? Unable to post?
No exception was found in the part you posted
Too big? Unable to post?
No exception was found in the part you posted
Some of the larger Enbi experienced exceptions.
I pasted the network disk file address upstairs.
$ S = file_get_contents ('d: \ My Documents \ Downloads \ provinces and cities around the world (English version ). xml '); preg_match_all ('/United. +/M', $ s, $ m); foreach ($ m [0] as $ v) {echo "$ v \ n"; echo bin2hex ($ v ), PHP_EOL ;}
United  arabâ Emirates "Code =" ARE ">
556e69746564 c2a041026162 c2a0456d6942517316732220436f64653d22415245223e0d
United  Kingdom "Code =" GBR ">
556e69746564c2a04b696e67646f6d2220436f64653d22474172223e0d
United  States "Code =" USA ">
556e69746564c2a05374617316732220436f64653d22555341223e0d
United  States  Minor  Outlying  Islands "Code =" UMI "/>
Bytes
See it? That's not a space. Although the performance is the same
Reverse Query
preg_match_all('/.+\xc2\xa0.+/m', $s, $m);foreach($m[0] as $v) { echo "$v\n"; echo bin2hex($v), PHP_EOL;}
More
In the gbk environment, you can see
.......
Cannot be pasted.
Thanks to the moderator. The problem has been solved. I have never encountered this problem before. today I learned another trick.