一个本地搜索,中文转码有关问题

WBOY
Release: 2016-06-13 13:37:36
Original
1194 people have browsed it

一个本地搜索,中文转码问题
一个本地的搜索,中文关键字改成了u8e4b880这种类型的编码。

例如"一" 转换后就是 "u8e4b880";
  "二"转换之后就是"u8e4ba8c";


这是通过什么函数之类的实现的啊?

------解决方案--------------------
e4b880 是"一"的 utft-8编码的十六进制表示
e4ba8c 是"二"的 utft-8编码的十六进制表示
冠以u8,表示后面的是utf-8的编码值

如果你的字符串是 gbk 编码的,那么就
$s = "二";
$s = iconv('gbk', 'utf-8', $s);
$ch = 'u8' . current(unpack('H*', $s));

这样就得到了 u8e4ba8c

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template