
Sharmila Thapa (Mark Information A/S) asked a question.
How can I read the language specific character example å, ø, æ using GetPathParameter method (IWebRequest)? When using this method I got the corrupted data. But I got the correct data when using GetQueryValue method.
Corrupted data or encoded data?
Sorry It is encoded. I have character Å in path parameter but I got Ã…
Tried with FIX-CODEPAGE, but doesn't help.
@Sharmila Thapa (Mark Information A/S) What codepage (-cpinternal) are you using?
And just to confirm, when you GET <instance>/web/hello/Å?str=Å and you have a handler defined as handlerX=myWH: /hello/{first} , in the HandleGet() in myWH, you do something like
Hi @Peter Judge (Progress Software) ,
It uses -cpinternal = ISO8859-1.
And My URI looks like /web/profiles/{profile_id}/details >> to display the details of {profile_id}
And the method looks like:
METHOD OVERRIDE PROTECTED INTEGER HandleGet(INPUT pclRequest AS IWebRequest):
DEFINE VARIABLE ichProfileId AS CHARACTER NO-UNDO.
ichProfileId = pclRequest:GetPathParameter("profile_id":U).
END METHOD.
I tried to use it as query parameter and get the value with GetQueryValue method, there is no issue with GetQueryValue method.
But as per the structure of my URI, I have to use GetPathParameter.
It's definitely related to cpinternal: you'll find that if you set the agent's -cpinternal to UTF-8 things will appear as you expect them to. I think the query string stuff works because those values are stored in (basically) UTF-8 strings and there's some conversion going on.
I think it's worth logging this difference in behaviour (between path params and query strings) as a bug with tech support.
[edit] I think the issue relates to the fact that the query string is URI encoded, as is the path value, but the path parameter is not.
Hi @Peter Judge (Progress Software) ,
Is there any other workaround to solve this issue as it works with GetQueryValue? Because we are in the process of moving to UTF-8 but not sooner and also need to fix this for previous released versions.
And I don't understand if the bug is to fix GetQueryValue to make it stop working and have it "consistent" with GetPathParameter, or to make GetPathParameter work just like GetQueryValue, which is what I would expect 😊
The fix would be to make the path parameter URI-encoded, which is what the query strings do (so work like your expectations).
You can work around it using code like the below. It uses the path segment instead of the CGI value. It assumes that you can only have a path parameter name once in the URL.
Hi @Peter Judge (Progress Software) ,
Thanks a lot. It solves my problem with a small change on following line:
assign ichProfileId = OpenEdge.Net.URI:Decode(entry(idx + 1, pclRequest:URI:Path, '/':u)). Instead of +1, it is +2 as the path also includes /ProjectName before /web.
Thank you for your support.
Have a nice day.
Hi @Peter Judge (Progress Software) , big thanks for the help.
We tested today with URI-Encoding UTF-8, and everything works perfect without you work-around.