2011年9月27日 星期二

VB.NET 中文字碼轉換

因為中文編碼的不同,在 big5 編碼中某些中文字出現了 很 這種亂碼
在 VB.NET 中可以用下面的方式解決

big5 轉 utf8

Dim tmpS As String = Me.TextBox1.Text
tmpS = Replace(tmpS, "&#", "")

tmpS = Replace(tmpS, ";", "")
Me.Label1.Text = ChrW(tmpS)

utf8 轉 big5
Me.Label1.Text = "&#" & AscW(Me.TextBox1.Text) & ";"


參考:
topcat姍舞之間的極度凝聚


沒有留言:

張貼留言