In my GeoExt client, I have the following line that retrieves JSON data from a web service into a FeatureStore:
var store = new GeoExt.data.FeatureStore({
layer: route_layer,
fields: [
{name: "length"}
],
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.HTTP({
url: "./php/pgrouting.php",
format: new OpenLayers.Format.GeoJSON({
internalProjection: epsg_900913,
externalProjection: epsg_4326
})
})
})
});
When this code is executed, Firebug reports the error SyntaxError: JSON.parse: unexpected character, even though the JSON returned by the web service is valid (I've confirmed this against http://jsonlint.com). The response header has been configured accordingly with the line header('Content-type: application/json',true);.
Anyone who might have encountered this issue before, please assist. I've waded around, but no luck yet.
UPDATE: Sample JSON output is at http://pastebin.com/LPLjBDgp. It's valid JSON, but the error SyntaxError: JSON.parse: unexpected character persists. I've even updated my html page by adding the following line <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> in an attempt to restrict character encoding.

json_encode()in the php page, but I've realized I haven't specified character encoding in the html page. I'll restrict character encoding to UTF-8 and get back to you. – okello Sep 4 '12 at 12:43