Autor Beitrag
new.Matrix
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Sa 31.05.08 09:35 
Halloo Zusammen,

Folgendes Problem habe ich:

Wenn ich eine Datei mittels StreamReader(Datei, Encoding.UTF7) auslese, bekomme ich die Umlaute, jedoch wird mir das + als ? ausgegeben. Wenn ich Encoding.UTF8 verwende, ist es genau anderst herum.

Weiss jemand eine Lösung?
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: So 01.06.08 11:37 
Was kommt denn heraus, wenn du das Encoding gar nicht angibst? Worin lässt du dir den Text anzeigen? Und eine kleine Beispieldatei wäre auch nicht verkehrt ;) .
Robert_G
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 416


Delphi32 (D2005 PE); Chrome/C# (VS2003 E/A, VS2005)
BeitragVerfasst: So 01.06.08 12:01 
Oder andere Frage: Kann es sein, dass du ASCII/Ansi mit Unicode verwechselst?
UTF7 ist Unicode!, UTF8 ist ebenfalls Unicode!
Du kannst keine Ansi oder ASCII Datei damit öffnen.
Probiere es mit Encoding.Ascii, oder Encoding.Default (Ansi)
JüTho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2021
Erhaltene Danke: 6

Win XP Prof
C# 2.0 (#D für NET 2.0, dazu Firebird); früher Delphi 5 und Delphi 2005 Pro
BeitragVerfasst: So 01.06.08 16:02 
Vergesst Encoding.ASCII auf (fast) jeden Fall: das befasst sich nur mit 7-bit-ASCII, kann Umlaute also keinesfalls verarbeiten. Wenn Encoding.Default nicht genügt, dann versucht es mit GetEncoding(n) mit n=1250, 1251, 1252 usw. (für ANSI) oder 850, 437 (für MS-DOS-Zeichensätze).

Alle Encodings sind übrigens aufgelistet im Beispiel unter Encoding.GetEncodings-Methode.

Jürgen
new.Matrix Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Di 10.06.08 11:23 
Besten Dank euch allen!

Die Lösung war Encoding.Default :-D