Please help me! >>>> System.Text.Encoding.UTF8.GetString(by) NOT works

G

George Baburanos

Hi,
On my Function "ObjectToString" the code line >>>
System.Text.Encoding.UTF8.GetString(by) NOT works why ?


<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Private Function ObjectToString(ByVal obj As Object) As String
Dim strString As String = "", i As Integer
Dim formatter As New
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Dim stream As New System.IO.MemoryStream
formatter.Serialize(stream, fntMainFont)
If stream.CanRead Then
Dim by() As Byte = stream.ToArray()

'this WORKS
For i = 0 To stream.Length - 1
strString += by(i).ToString
Next

'this NOT works why ??? >>>> strString =
System.Text.Encoding.UTF8.GetString(by)

End If
stream.Close()
stream = Nothing
formatter = Nothing
Return strString
End Function
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


Thank you
George Baburanos
Greece
 
G

George Baburanos

Hi

Return ""

This mean empty string

Thak you

yEah rIgHt said:
What should it return? A string with characters i.e A,B,C, or a string
of bytes i.e 0010203101030
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top