[OpenLayers-Users] encoding international characters
Christopher Schmidt
crschmidt at metacarta.com
Sun Apr 22 09:28:12 EDT 2007
On Sun, Apr 22, 2007 at 05:03:11AM -0700, Duarte Carreira wrote:
> For instance "ALC??CER" should encode to "ALC%C1CER", that's what the browser
> does if I write the query in the address box.
I have a feeling the difference here is related to character sets: the
character you've just described should be encoded that way if it is in
iso-8859-1, but not in UTF-8. It seems that the 'encodeURIComponent'
Javascript function which is used (a Javascript builtin) is converting
this to utf-8. It's not clear to me whether this is the 'right' thing or
not, but it is certainly causing you problems.
A workaround is to override the encodeURIComponent functino by placing
this as the first line of your init():
encodeURIComponent = function(data) { return data; }
This will override the Javascript builtin, and cause OpenLayers to not
encode your data. I can't speak to whether this is the 'right' thing to
do, but it will let you move forward with the application.
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list