PHP の UTF8Encoding.UTF8.GetBytes(key) に対応する C# のメソッドはどれですか? どうやって書くの?
C# の UTF8Encoding.UTF8.GetBytes(key) は、PHP のどのメソッドに対応しますか?
はどうやって書くの?
------ソリューションのアイデア----------------------
$s = '中文abc';<br />$s = iconv('gbk', 'utf-8', $s); //不是 utf-8 时需转 utf-8<br />print_r(unpack('C*', $s));
Array<br />(<br /> [1] => 228<br /> [2] => 184<br /> [3] => 173<br /> [4] => 230<br /> [5] => 150<br /> [6] => 135<br /> [7] => 97<br /> [8] => 98<br /> [9] => 99<br />)<br /><br />C# テスト
foreach (var c in UTF8Encoding.UTF8.GetBytes("中文abc"))<br /> {<br /> Console.WriteLine(c);<br /> }<br />
$s = '中文abc';<br />$s = iconv('gbk', 'utf-8', $s); //不是 utf-8 时需转 utf-8<br />print_r(unpack('C*', $s));
Array<br />(<br /> [1] => 228<br /> [2] => 184<br /> [3] => 173<br /> [4] => 230<br /> [5] => 150<br /> [6] => 135<br /> [7] => 97<br /> [8] => 98<br /> [9] => 99<br />)<br /><br />C# テスト
foreach (var c in UTF8Encoding.UTF8.GetBytes("中文abc"))<br /> {<br /> Console.WriteLine(c);<br /> }<br />