php - 强制字符格式为 UTF-16

标签 php unicode utf-16

所以,如果我有一个准unicode UTF-16字符编码

0x14e
0xf6

我如何确保它严格遵守标准?

0x014E
0x00F6

我意识到我可以进行一些字符串操作,但我似乎找不到 PHP 的内置方法...

最佳答案

您可以使用 mb_detect_encoding() 进行验证。 http://php.net/manual/en/function.mb-detect-encoding.php

关于php - 强制字符格式为 UTF-16,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12962201/

相关文章:

elasticsearch - 哪种最佳做法是在python3中的混合编码文本中跳过非ascii字符?

utf-8 - Emacs 中的 Rgrep 使用 ripgrep

php - Ubuntu 14.04 服务器 : Apache2 issue with phpMyAdmin

php - 如何从 cakephp 默认布局调用 Controller ?

php - 为什么只有一台服务器抛出错误 "Array to String Conversion"?

php - Sobel 过滤器上的这段代码有什么问题?

python - 如何使用 utf-8 编码将 DataFrame 导出到 Html?

postgresql - 获取 Unicode 值 [PostgreSQL]

c++ - 如何使用 std 库在 Linux 上从 utf-16 转换为 utf-32?

c# - 在 C# 中使用没有字节顺序标记 (BOM) 的 UTF-16 编码保存文本文件?