Thanks a lot. Adding the parameter System.Text.Encoding.Default did the
However, I also do a rewrite with the SreamWriter. I assume I need to add
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:uY70IzTpHHA.1776@TK2MSFTNGP05.phx.gbl...
> "Martin" <x@y.com> schrieb:
>> The code Im using to read the file is I think pretty straightforward:
>>
>> Private Sub DoOpenFile(ByVal ThisFile As String)
>> Dim Line As String
>>
>> Try
>> Dim sr As System.IO.StreamReader = New
>> System.IO.StreamReader(ThisFile, True)
>> Line = sr.ReadLine()
>> sr.Close()
>> Catch Ex As Exception
>> MsgBox("Error reading file" & Chr(13) & Chr(13) & Ex.Message,
>> MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error")
>> Exit Sub
>> End Try
>>
>> Line = DoFormatLine(Line)
>> FillEditor(Line)
>> FileName = ThisFile
>> Editor.ReadOnly = False
>> Me.Text = "Editing " & FileName
>> End Sub
>>
>> The text is created in an editor (MultiEdit) and looks like this:
>>
>> FTX+AAK+1++Es bestehen Vereinbarungen, aus denen sich nachträgliche
>> Minderungen :des Entgelts ergeben können.+DE
>>
>> When I open this in my app, it suddenly looks like this:
>>
>> FTX+AAK+1++Es bestehen Vereinbarungen, aus denen sich nachtr�gliche
>> Minderungen :des Entgelts ergeben k�nnen.+DE
>
> So, you are not writing the data using .NET's 'StreamWriter' at all. Most
> likely the other application stores the file using the Windows ANSI
> encoding with the system's default codepage. In order to read the file,
> pass 'System.Text.Encoding.Default' to the 'StreamReader''s constructor or
> determine the encoding for a certain codepage using
> 'Encoding.GetEncoding'.
>
>> After your message I added the TRUE parameter in the streamreader (detect
>> encoding) and set the form's language to German... To no effect.
>
> Well, detecting the encoding isn't always possible because byte sequences
> contained in the file may be valid for different encodings.
>
> --
> M S Herfried K. Wagner
> M V P <URL:
http://dotnet.mvps.org/> > V B <URL:
http://classicvb.org/petition/>