|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
problem with encodingDim 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. Thus wrote Vaidas,
> Code: Don't use US-ASCII. That's 7 bit only and no good for most European languages. > > 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. You should be using the encoding specified by mail's headers. Cheers, -- Joerg Jooss news-re***@joergjooss.de 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 > > Thus wrote Vaidas,
> How to make encoding like this Use System.Text.Encoding.GetEncoding() to create an Encoding instance by > > Content-Type: text/plain; > > charset="iso-8859-2" its IANA name, e.g. Encoding latin2 = Encoding.GetEncoding("iso-8859-2"); Cheers, -- Joerg Jooss news-re***@joergjooss.de 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 > > 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 |
|||||||||||||||||||||||