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;
}