Home All Groups Group Topic Archive Search About

problem with encoding

Author
4 Apr 2006 11:40 AM
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.

Author
4 Apr 2006 9:25 PM
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,
--
Joerg Jooss
news-re***@joergjooss.de
Author
5 Apr 2006 5:09 AM
Vaidas Gudas
How to make encoding like this

Content-Type: text/plain;

charset="iso-8859-2"



Show quote
"Joerg Jooss" <news-re***@joergjooss.de> wrote in message
news:94fc5071225328c826562bcbd018@msnews.microsoft.com...
> 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,
> --
> Joerg Jooss
> news-re***@joergjooss.de
>
>
Author
5 Apr 2006 5:28 AM
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,
--
Joerg Jooss
news-re***@joergjooss.de
Author
5 Apr 2006 8:10 AM
Vaidas Gudas
It dont work

Show quote
"Joerg Jooss" <news-re***@joergjooss.de> wrote in message
news:94fc5071226288c82699a9413c52@msnews.microsoft.com...
> 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, --
> Joerg Jooss
> news-re***@joergjooss.de
>
>
Author
6 Apr 2006 6:16 AM
Jon Skeet [C# MVP]
Vaidas Gudas <vaidas.gu***@rst.lt> wrote:
> It dont work

Well, that line of code definitely *does* work. If something else
doesn't work, you need to give us more information.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

AddThis Social Bookmark Button