nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

XHR und encoding

Von: Chris Seidel (cseidel@arcor.de) [Profil]
Datum: 25.10.2009 11:04
Message-ID: <op.u2coxkv6w1eelo@msrvcn04.localdomain>
Newsgroup: de.comp.lang.javascript
Hallo,

ich hole via XHR eine Textdatei vom Server:

xmlhttp.open("GET", url, false);
xmlhttp.send(null);
var text = xmlhttp.responseText;

Request
Host	localhost:8081
User-Agent	Mozilla/5.0 (Windows; U; Windows NT 5.2; en-GB; rv:1.9.0.14)


Gecko/2009082707 Firefox/3.0.14 (.NET CLR 3.5.30729)
Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0
.8
Accept-Language	de-de,en;q=0.7,de;q=0.3
Accept-Encoding	gzip,deflate
Accept-Charset	ISO-8859-1,utf-8;q=0.7,*;q=0.7


Response
Server	Apache-Coyote/1.1
Etag	W/"98-1256399055209"
Last-Modified	Sat, 24 Oct 2009 15:44:15 GMT
Content-Length	98
Date	Sun, 25 Oct 2009 09:52:17 GMT


Die Datei ist ISO-8859-1 kodiert. Leider kommen im Javascript Umlaute

zerschossen an.

Setze ich xmlhttp.overrideMimeType("text/plain; charset=ISO-8859-1");


klappt es.

Fragen:

1. Müsste es nicht per Default ISO-8859-1 sein?
2. Wie löse ich das im IE, der kennt overrideMimeType nicht.

Danke

[ Auf dieses Posting antworten ]

Antworten