Here is the URL I am working with:
my.website/?param1=Økonomi¶m2=Penger
In order to retrieve the parameter values, I am using the following function:
function extractParamValue(url, key) {
var parameters = {};
var urlParams = url.split("?", 2);
if (urlParams.length > 1) {
var paramList = urlParams[1].split("&");
paramList.map(function (paramString) {
var keyValue = paramString.split("=", 2);
parameters[keyValue[0]] = keyValue[1];
});
}
return (key in parameters)? decodeURIComponent(parameters[key]) : ''
}
When I check the results after extracting, I see that the values returned are:
param1 = %C3%98konomi
and param2 = Penger
However, when I compare these values with my dataset, I am unable to find a match for Økonomi
where Ø
has a capital letter. Interestingly, if I change it to økonomi
, then I do get a match.
Why is it that the encoded URI value %C3%98
is not translating to Ø
? How can I ensure that it does in future queries?