vb2008如何将中文转换成Utf8编码并用Text控件输出
展开全部
以下是相互转换
Dim bytes As Byte() = System.Text.Encoding.UTF8.GetBytes("你的中文字串")
Dim yourstring As String = System.Text.Encoding.UTF8.GetString(bytes)
utf8编码的结果是byte(),你要输出到text里做什么用?只是显示一下二进制的值吗?
Dim sout As New System.Text.StringBuilder
For i As Integer = 0 To bytes.Length - 1
sout.Append(bytes(i).ToString("000 "))
Next
text1.Text = sout.ToString
Dim bytes As Byte() = System.Text.Encoding.UTF8.GetBytes("你的中文字串")
Dim yourstring As String = System.Text.Encoding.UTF8.GetString(bytes)
utf8编码的结果是byte(),你要输出到text里做什么用?只是显示一下二进制的值吗?
Dim sout As New System.Text.StringBuilder
For i As Integer = 0 To bytes.Length - 1
sout.Append(bytes(i).ToString("000 "))
Next
text1.Text = sout.ToString
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询