problem with encoding

V

Vaidas Gudas

Code:

Dim enc As New System.Text.ASCIIEncoding

Dim serverbuff(1024), buff(0) As Byte

Dim count, bytes As Integer

Dim stream As NetworkStream

stream = o.GetStream()

While 1 = 1

bytes = stream.Read(buff, 0, 1)

If bytes = 1 Then

serverbuff(count) = buff(0)

count = count + 1

If buff(0) = Asc(vbLf) Then

Exit While

End If

Else

Exit While

End If

End While

Return enc.GetString(serverbuff, 0, count)

I am using POP 3 protocol and I am rading the data from exchange server.
I am geting the data from POP3 in string format, but some character, witch
it is not Latin characters is enncoded, and I need to decode to Lithuanian
character set. How to make this.
 
J

Joerg Jooss

Thus wrote Vaidas,
Code:

Dim enc As New System.Text.ASCIIEncoding [...]
I am using POP 3 protocol and I am rading the data from exchange
server.
I am geting the data from POP3 in string format, but some character,
witch
it is not Latin characters is enncoded, and I need to decode to
Lithuanian
character set. How to make this.

Don't use US-ASCII. That's 7 bit only and no good for most European languages.
You should be using the encoding specified by mail's headers.

Cheers,
 
V

Vaidas Gudas

How to make encoding like this

Content-Type: text/plain;

charset="iso-8859-2"



Joerg Jooss said:
Thus wrote Vaidas,
Code:

Dim enc As New System.Text.ASCIIEncoding [...]
I am using POP 3 protocol and I am rading the data from exchange
server.
I am geting the data from POP3 in string format, but some character,
witch
it is not Latin characters is enncoded, and I need to decode to
Lithuanian
character set. How to make this.

Don't use US-ASCII. That's 7 bit only and no good for most European
languages. You should be using the encoding specified by mail's headers.
Cheers,
 
J

Joerg Jooss

Thus wrote Vaidas,
How to make encoding like this

Content-Type: text/plain;

charset="iso-8859-2"

Use System.Text.Encoding.GetEncoding() to create an Encoding instance by
its IANA name, e.g.

Encoding latin2 = Encoding.GetEncoding("iso-8859-2");

Cheers,
 
V

Vaidas Gudas

It dont work

Joerg Jooss said:
Thus wrote Vaidas,


Use System.Text.Encoding.GetEncoding() to create an Encoding instance by
its IANA name, e.g.

Encoding latin2 = Encoding.GetEncoding("iso-8859-2");

Cheers, --
Joerg Jooss
(e-mail address removed)
 

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