Home >Backend Development >PHP Tutorial >请问下unicode编码如何输出汉字

请问下unicode编码如何输出汉字

WBOY
WBOYOriginal
2016-06-23 13:30:591479browse

unicode 十进制值为26575 对应汉字应该是“柏”,PHP中怎样通过这个十进制值输出这个汉字呢?急,在线等


回复讨论(解决方案)

$n = 26575;echo mb_convert_encoding(sprintf('&#%d;', $n), "gbk", 'HTML-ENTITIES');echo iconv('ucs-2', 'gbk', pack('n', $n));

两种都可以

UCS-2 和 UTF-16 等价

Statement:
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