Right. You come in with a string of variable length and it's going to create a variable number of bytes with an array. Then the byte buffer of variable length is converted into a variable length string.
Those routines are sort of randon character generators.
Public Function utf8_decode(ByVal indata As String) As String Dim buffer() As Byte = Encoding.UTF8.GetBytes(indata) Return Encoding.Default.GetString(buffer) End Function
Public Function utf8_encode(ByVal indata As String) As String Dim buffer() As Byte = Encoding.Default.GetBytes(indata) Return Encoding.UTF8.GetString(buffer) End Function
Public Function utf8_decode(ByVal indata As String) As String Dim buffer() As Byte = Encoding.UTF8.GetBytes(indata) Return Encoding.Default.GetString(buffer) End Function
Public Function utf8_encode(ByVal indata As String) As String Dim buffer() As Byte = Encoding.Default.GetBytes(indata) Return Encoding.UTF8.GetString(buffer) End Function
For a moment let's talk about three things. The inputs, outputs and your display.
What is the input and the input datatype What is the output and the output datatype What are your display needs In your words, that determines what it's supposed to be
Help to Convert ASCII to UTF-8 - Should be Simple
Carl Tawn
Right. You come in with a string of variable length and it's going to create a variable number of bytes with an array. Then the byte buffer of variable length is converted into a variable length string.
Those routines are sort of randon character generators.
"Im saying i need to encode it back to utf8"
It was never utf8 to begin with.
Rodboy
seamus.glynn
OK.... I'm looking at the bits.
Are you saying that the display is not displaying the data correctly
JockePe
nvm i found the answer.
Public Function utf8_decode(ByVal indata As String) As String
Dim buffer() As Byte = Encoding.UTF8.GetBytes(indata)
Return Encoding.Default.GetString(buffer)
End Function
Public Function utf8_encode(ByVal indata As String) As String
Dim buffer() As Byte = Encoding.Default.GetBytes(indata)
Return Encoding.UTF8.GetString(buffer)
End Function
JEP
Im trying to add it to a listview
vkumar
Public Function utf8_decode(ByVal indata As String) As String
Dim buffer() As Byte = Encoding.UTF8.GetBytes(indata)
Return Encoding.Default.GetString(buffer)
End Function
Public Function utf8_encode(ByVal indata As String) As String
Dim buffer() As Byte = Encoding.Default.GetBytes(indata)
Return Encoding.UTF8.GetString(buffer)
End Function
marguslapp
What's your datatype
dksimon
Im saying i need to encode it back to utf8
rschnell
OK !!! Now we're getting somewhere.......
For a moment let's talk about three things. The inputs, outputs and your display.
What is the input and the input datatype What is the output and the output datatype What are your display needs In your words, that determines what it's supposed to be
Information about your architecture is needed.
Shiku
None of those characters are ascii.
"Uc" this is two unicode characters.
This is one. I guess what isn't clear is your requirements.©2008 Software Development Network
powered by phorum