Chinese characters are not displayed properly in the web pages of wso2am-analytics-2.6.0

2020-03-24 wso2 wso2-am

I have installed API Manager and APIM Analytics on CentOS 7.6, the version is 2.6.0. I find that Chinese characters are not displayed properly in the pages of the Analyze dropdown menu.

enter image description here

But the Chinese characters are able to be displayed properly in other pages

enter image description here

So this problem is focused on "APIM Analytics". I have checked the data in H2 database, I find that the data of H2 is correct, but the returned Json data is not correct.

enter image description here


enter image description here

I also checked a Shell file /usr/lib64/wso2/wso2am/wso2am-analytics-2.6.0/wso2/worker/bin/, I found that -Dfile.encoding=UTF8 has been configured.

enter image description here

I doubt whether the data is not encoded in the transmission process. Has anyone met this problem?

--- Additional content (2020/3/25) ---

I just checked deployment.yaml, which is at /usr/lib64/wso2/wso2am/wso2am-analytics-2.6.0/conf/worker. I did not find out any configuration item of character set.

enter image description here

I also reviewed usage.jag, which is at /usr/lib64/wso2/wso2am/2.6.0/repository/deployment/server/jaggeryapps/store/modules/statistics. As you can see, there is not any program logic of data query. I guess I'll have to read the source codes of wso2am-analytics-2.6.0. I don't think it is an efficient way.

enter image description here

--- Additional content (2020/3/26) ---

I found that some strange symbols are appended to the returned Json data(shown in the screenshot below). The returned Json data is as follows: å\u0085¨ç\u0090\u0083é£\u008eå\u0090\u0091æ\u009f¥è¯¢ (admin), normal Json data should look like this: \u6f22\u5b57.

enter image description here


I find a suspicious point in the source code, the details are as follows:

Github repository is "wso2 / carbon-apimgt", Java file is "org.wso2.carbon.apimgt.impl.utils.APIUtil", the method is "executeQueryOnStreamProcessor".

The key code is “String responseStr = EntityUtils.toString(entity);”. According to document of HttpClient, EntityUtils.toString() method is going to use the default character set, which is ISO-8859-1, if other character set (For instance: UTF-8) is not specified for it.

So the point is that ISO-8859-1 can not process Chinese information properly.

I hope the developers of WSO2 can notice that ASAP.