C# 正確抓出/計算 UTF8字串長度
C# 正確抓出/計算 UTF8字串長度
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CS_UTF8 { class Program { static void Main(string[] args) { String StrEN, StrTW, StrCN; StrEN = "English name"; StrTW = "英文名稱"; StrCN = "英文名称"; byte[] buf01 = Encoding.UTF8.GetBytes(StrEN);//12 byte byte[] buf02 = Encoding.UTF8.GetBytes(StrTW);//12 byte byte[] buf03 = Encoding.UTF8.GetBytes(StrCN);//12 byte } } }
One thought on “C# 正確抓出/計算 UTF8字串長度”
C# String 轉 UTF8 byte 陣列