473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

VB.NET: 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:
Expand|Select|Wrap|Line Numbers
  1. Shared Function ReadMessage(ByVal sslStream As SslStream) As String
  2.         Dim buffer(2048) As Byte
  3.         Dim messageData As StringBuilder = New StringBuilder
  4.         Dim bytes As Integer = -1
  5.  
  6.         bytes = sslStream.Read(buffer, 0, buffer.Length)
  7.  
  8.         Dim decoder As Decoder = Encoding.GetEncoding("iso-8859-1").GetDecoder
  9.         Dim chars(decoder.GetCharCount(buffer, 0, bytes, True)) As Char
  10.  
  11.         decoder.GetChars(buffer, 0, bytes, chars, 0, True)
  12.         messageData.Append(chars)
  13.  
  14.         Return messageData.ToString
  15. End Function
What I'm doing wrong?

Thanks in advance,
Pedro
Sep 3 '08 #1
0 1076

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: JerryW | last post by:
I just reinstalled .NET 2003 (after repeated attempts to get ASP.NET Web Applications to work). I first did a complete uninstall of .NET 2003, .NET Framework 1.1, and IIS. I also completely deleted...
8
by: Vinod | last post by:
Hi, I have a stored procedure which expects a varbinary datatype. How can i pass a varbinary datatype from asp.net directly to the stored procedure. I tried using the Convert function in Sql...
7
by: c.verma | last post by:
I have a web application. There is a page which has a datagrid on it.The datagrid displays the data that comes from SAP. SAP sends the chinese characters to this grid. Before I display CHinese...
2
by: John Dalberg | last post by:
The below html validates correctly on w3.org's html validator when the file has an html extension. When the same file gets an aspx extension, I get the error below from the validator. This tells me...
2
by: DJ | last post by:
ANY HELP FROM THE MASTERS GREATLY APPRECIATED When reading textfiles with VB.net, some special character text is deleted that does not happen with VB6 (Please see below) ORIGINAL TEXT FILE...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
6
by: fossmo | last post by:
Is there a way to force an encoding in a asp.net site? I have tried to save the pages in utf-8 encoding, with a lot of succsess. Letters like ÆØÅ (norwegian letters) are displayed when I do it...
2
by: Christopher Brandsdal | last post by:
Hi! I have found a script to lookup domain names, but it is written in C#. I want so bad to translate this to VB! Can anyone help me? I have tried myself. The script seems to run fine, but I...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
3
sid0404
by: sid0404 | last post by:
Hi I am new to the programming in c#, I have an application where I need to get data from a website now I am getting an error message if I give the input as two strings, say Sun Microsystems while...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.