Using GWT, I've got a webapp, and on a certain page it pulls a parameter from the URL that has the pipe character (|) encoded. So, for example, the full URL would be (in dev mode):
http://127.0.0.1:8888/Home.html?gwt.codesvr=127.0.0.1:9997#DynamicPromo:pk=3%257C1000
and when I pull the parameter "pk" I should get "3|1000". (%257C is the encoded pip char)
Well, this works just fine in Firefox and Chrome.
In IE (I'm using 11), I get "3%7C1000" when I pull the parameter. For whatever reason, IE drops the 25 in the encoded character, meaning it's no longer a pipe char and my app breaks.
I've read around and found that encoding issues are common on IE. In particular, I found this page: http://support.microsoft.com/kb/928847
It's suggested solutions include:
I've tried those 3 and it didn't help. Here is the beginning of my Home.html:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
The other two suggestions:
I don't feel will do anything. My system locale settings are correct. And since my meta tags are at the beginning of the document, they are within the first kilobyte of data, so they would be read first. So I don't see why I'd need to increase the HTTP response size.
So, I need IE to properly read this encoded character for the web application to work properly. Does anyone have any other suggestions I could try?
UPDATE:
How the URL is encoded:
URL.encodePathSegment(place.getValue())
Where URL is from the package com.google.gwt.http.client
getValue() is set from this:
public static String encodePk(PrimaryKey pk)
{
if(pk != null)
{
return String.valueOf(pk.getPk()).concat("|").concat(String.valueOf(pk.getCpk()));
}
else{
return "";
}
}
The final result is the url I posted at the top:
http://127.0.0.1:8888/Home.html?gwt.codesvr=127.0.0.1:9997#DynamicPromo:pk=3%257C1000
Where the part after "pk=" is the encoded string.
In order to make sure IE kept the encoding intact, I had to first decode the URL as soon as I set it:
public void setValue(String value)
{
this.value = unescape(value);
}
private static native String decodeURI( String s )
/*-{
return decodeURI(s);
}-*/;