I tried all possible answers this and this , but it didn't worked for me. Now writing the question.
private String convertValue(String val){
System.out.println("convert input:" + val);
String res = "";
StringTokenizer st = new StringTokenizer(val,",");
while(st.hasMoreTokens()){
String token = st.nextToken();
if (token.matches("([0-9]*)")) {
char c = (char)Integer.parseInt(token);
res+=c;
}else{
res+=token;
}
}
System.out.println("convert output:" + res);
return res;
}
When running out of the jboss 7 it gives:
convert input:61,1087,1088,1080,1074,1077,1090
convert output:=привет
Running in the jboss 7 by action:
convert input:61,1087,1088,1080,1074,1077,1090
convert output:=??????
Why it is not working properly?
My standalone.xml:
<extension module="org.jboss.as.weld"/>
</extensions>
<system-properties>
<property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
<property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>
</system-properties>
added java opts(-Dfile.encoding=UTF-8):
convert input:61,1087,1088,1080,1074,1077,1090
convert output:=–ø—Ä–∏–≤–µ—Ç
EDIT 1: My environment:
Mac OS X Version 10.7.5
JBoss 7.1.1.Final
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
EDIT 2: Code snippet above working in javax.enterprise.context.RequestScoped back bean controller when pressing button from JSF page.