You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Raghuveer <ra...@infotechsw.com> on 2008/06/18 16:55:08 UTC
retriving polish characters from URL Query string
Polish characters from other web application.
I had requirement of retrieving the login details like user_id,name from
parent web application.
At present I am retrieving by .
request.getParameter("user_id")
request.getParameter("name")
Some times names can be in Polish language from parent web application.
What changes i need to make in my JSP Struts web application in order to
retrieve the polish characters
>From URL by http request with out corruption in characters.
Could you please advice if the following code is correct
Example:
if(request.getParameter("name")!=null){
strTemp = request.getParameter("name");
if(strTemp!=null && !"".equalsIgnoreCase(strTemp)){
strTemp=processText(strTemp);
}
}
/**
* This method is used to process the text coming from
HttpRequest.
* ISO-8859-1 to UTF-8
* @param strText
* @return strResult
*/
private String processText(String strText){
String strConvertedMessage =null;
String strResult=null;
if(strText!=null && !"".equalsIgnoreCase(strText)){
try {
strConvertedMessage = new
String(strText.getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e)
{
// TODO Auto-generated catch
block
e.printStackTrace();
}
strResult=strConvertedMessage;
}else{
strResult=strText;
}
return strResult;
}
Re: retriving polish characters from URL Query string
Posted by Lukasz Lenart <lu...@googlemail.com>.
Hi,
First of all, isn't possible to encode Polish characters with
ISO-8859-1, you have to use ISO-8859-2 or UTF-8. It's mean, that the
parent web application has to send user_id, name parameters encoded
with ISO-8859-2 or UTF-8. Without that it will be not possible to
decode such strings.
Regards
--
Lukasz
http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org