Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 3rd, 2008, 11:59 AM
Newbie
 
Join Date: Sep 2008
Posts: 1
Default Text encoding

Hi everyone!

I'm facing a problem that I can not solve.
I'm developping a VB.NET application to read my mail.
However, some of my mail messages are encoded in ISO-8859-1.

How can I convert my stream to ISO-8859-1?

Here's my (not working) code:
Code:
Shared Function ReadMessage(ByVal sslStream As SslStream) As String
        Dim buffer(2048) As Byte
        Dim messageData As StringBuilder = New StringBuilder
        Dim bytes As Integer = -1

        bytes = sslStream.Read(buffer, 0, buffer.Length)

        Dim decoder As Decoder = Encoding.GetEncoding("iso-8859-1").GetDecoder
        Dim chars(decoder.GetCharCount(buffer, 0, bytes, True)) As Char

        decoder.GetChars(buffer, 0, bytes, chars, 0, True)
        messageData.Append(chars)

        Return messageData.ToString
End Function
What I'm doing wrong?

Thanks in advance,
Pedro
Reply
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles