Text.Encoding... ISO-8859-1

  • Thread starter Thread starter Ville Pirhonen
  • Start date Start date
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
 
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
 
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
 
Back
Top