views:

294

answers:

3

Hi my problem is a bit wired:

my $.ajax success handler looks like:

function(data){
        alert(data);
}

Pretty simple, yeah?

The problem is that data IS ALWAYS 3 character long - no matter what was sent by the server! The characters: 31 65535 8 (using charCodeAt()).

In other browsers (even in IE 8) all works fine.

I've looked at xhr.responseText in complete handler - just the same result.

UPDATE Full http response

HTTP/1.1 200 OK
Date: Sun, 07 Feb 2010 13:35:39 GMT
Server: Apache/2.2.12 (Ubuntu)
X-Powered-By: PHP/5.2.10-2ubuntu6.4
Set-Cookie: 1111111111111111=UjVXb1Q3WTdUIQ8jXmALbA88VzpRcVcgBzMDcldyUmtWawAyAFpQP1IwASEAbFh%2FDjoLZ1RiBWlWdwBnUGMHZlU2UGBTZFA5B2UMMlJgC29SbVdjVDRZOVRsDzReaQtuDzpXZVFjV2UHYwM1VzNSNlYzAG4AMVAwUjUBIQBsWH8OOgtlVGAFaVZ3AD5QIgdcVWVQNlNhUHIHMAwjUiQLL1JvVyZUOVk8VGkPal54C2wPNVcyUX1XYgdgAzlXL1IzVioAbQA3UG9SdgE4ACRYNg4xC2RUagVxViAAJFA3B3FVW1AzU2JQZQc7DCRSdQs2UidXb1Q2WT1UYA9yXhcLMg92V2lRP1c%2FBzcDLlc1UixWNAB8AC1QNVI7AW4AJ1htDnQLPVQyBT9WMABsUHIHTlVXUBtTQFAgB20MflJnCzZSdFcCVGpZY1Q%2BDz9eLQsuDyxXTlEHV3MHYAMvVzBSOVYmAGcAdlBsUmUBMABtWC4ObAs1VCMFJ1YKADZQMQd3VW1QJFNsUHQHLAxyUmwLflJuV2RUM1k3VHgPYV5oC2sPOVc1UWdXagdgAzBXOVIgVj8AIQ%3D%3D; expires=Tue, 07-Feb-2012 13:35:39 GMT; path=/
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 21
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html

1

UPDATE ! Well, problem temporary? solved by disabling gzip in .htaccess

A: 

The characters you get look weird, but could it be that it's a BOM? It's none of the ones listed in the article, but maybe getCharCode() gets something wrong.

In that case, you would have to check the script you call to request the data. Try saving it explicitly without a BOM.

Pekka
server-side script it's just echo "1";
Trickster
@Trickster Well, have you checked for a BOM? It's an invisible mark in the beginning of the file.
Pekka
please note update in my post
Trickster
What happens if you add a `Content-Type: text/html; charset=UTF-8` header? Have you checked the encoding of your file?
Pekka
nothing has changed
Trickster
Have you checked out the BOM issue?
Pekka
A: 

Hi ,

this is most times an problem with propper encoding of the requested content / displayed content.

Please verify that both use the same format.

ArneRie
please note update in my post
Trickster
A: 
naugtur