C# 中 UTF8Encoding.UTF8.GetBytes(key),对应PHP中的哪个方法? 如何写
程序员文章站
2022-05-30 19:58:52
...
C# 中 UTF8Encoding.UTF8.GetBytes(key),,对应PHP中的哪个方法? 怎么写?
C# 中 UTF8Encoding.UTF8.GetBytes(key),,对应PHP中的哪个方法?
怎么写?
------解决思路----------------------
------解决思路----------------------
C# 中 UTF8Encoding.UTF8.GetBytes(key),,对应PHP中的哪个方法?
怎么写?
------解决思路----------------------
$s = '中文abc';
$s = iconv('gbk', 'utf-8', $s); //不是 utf-8 时需转 utf-8
print_r(unpack('C*', $s));
ArrayC#测试
(
[1] => 228
[2] => 184
[3] => 173
[4] => 230
[5] => 150
[6] => 135
[7] => 97
[8] => 98
[9] => 99
)
foreach (var c in UTF8Encoding.UTF8.GetBytes("中文abc"))
{
Console.WriteLine(c);
}
------解决思路----------------------
$s = '中文abc';
$s = iconv('gbk', 'utf-8', $s); //不是 utf-8 时需转 utf-8
print_r(unpack('C*', $s));
ArrayC#测试
(
[1] => 228
[2] => 184
[3] => 173
[4] => 230
[5] => 150
[6] => 135
[7] => 97
[8] => 98
[9] => 99
)
foreach (var c in UTF8Encoding.UTF8.GetBytes("中文abc"))
{
Console.WriteLine(c);
}
相关文章
相关视频