Text.Encoding... ISO-8859-1

V

Ville Pirhonen

is there easy way encode ISO-8859-1 (7-bit) to unicode?

example..
=?iso-8859-1?Q?=F6=E4?=
to
öä

I tried Dim iso8859 As System.Text.Encoding =
System.Text.Encoding.GetEncoding("ISO-8859-1")
and getDecoder, but I didn't manage to get it work...


Cheers, Ville
 
J

Jay B. Harlow [MVP - Outlook]

Ville,
I've never needed to call GetDecoder directly.

Normally I apply the encoding I need to the Stream object I am using via a
StreamReader class, something like:

Dim stream As Stream ' file or network stream where your data is
Dim encoding As Encoding = Encoding.GetEncoding("ISO-8859-1")
Dim reader As New StreamReader(stream, encoding)
Dim line As String = reader.ReadLine()

If I have the encoded text in a Byte array, then I simply use the GetBytes &
GetString method of the encoding object.

Dim bytes() As Byte = encoding.GetBytes("this is a string")
Dim str As String = encoding.GetString(bytes)

Hope this helps
Jay
 
M

Mark P

if you are converting strings to strings there may be errors.
your could be more specific about your code, 2 or 3 lines would be enough
 

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