我的一个适配器返回一些包含特殊字符的数据(如引号、项目符号或问号等)
onSuccess
在适配器调用中,我将数据保存在一个变量中,如下所示。
try{
var data = JSON.stringify(response.invocationResult) ;
var _meetingDetailsArray = JSON.parse(data).MXEMEETINGSet.EMEETING ;
}catch(Exception) {
logger.error( Exception );
}
之后,我挑选出所需的字段/值并将它们保存在另一个 js 对象中,如下所示。
var _summary = ( _meetingDetailsArray.EMEETINGITEM.TCMEETING.VLSUMMARY || "" ) + ( _meetingDetailsArray.EMEETINGITEM.TCMEETING.VLSUMMARY_LONGDESCRIPTION || "" );
//below did not work even
//_summary = _summary.replace(/\“/g,"“").replace(/\”/g,"”").replace(/•/g,"<br>•");
UserProfile.getUserProfileDetails().userMeetingFullDetails.MeetingItems.STANDARD.Summary.push( _summary );
在 上查看结果时devices (iOS, Android)
,显示奇怪的字符。
我正在使用JQuery Mobile 2.1.3和Bootstrap 3.3.2并且所有页面都是动态加载的。主要index.html
已经包含chartset
但仍然没有好处。
<meta charset="utf-8"/>
但是,在 chrome 之类的桌面浏览器上,它显示得很好。
更新
我已应用iFix v6.3.0.0 InterimFix 201505212300但结果仍然相同
更新后,适配器按原样发回特殊字符,而之前它们已转换为 Unicode 格式。
环境:
- Eclipse -Luna 服务版本 2 ( 4.4.2 )
- MobileFirst Studio - 6.3.0.00-20150521-2300
- MobileFirst 6.3(内部版本号:IMF 00-20150521-2300)
- IBM WAS Liberty Profile 8.5.5.5(基本版本)
更新 2
如果我通过桌面 Chrome ( ) 上的 Eclipse 开发工作室运行通用应用程序latest Version 43.0.2357.81 m
并通过适配器通过 VPN 访问后端数据,那么它shows correct data with correct special characters like quotation marks (") or bullets etc.
但是,如果我在同一个 chrome 桌面浏览器中访问部署在另一台服务器机器(上述规格)上的同一个通用应用程序,那么如上所示。it does not handle special characters and shows strange characters.
我检查了HTTP 请求/响应,两者都相同。
当地发展回应:
GET /myProject/apps/services/preview/eMeeting/common/1.0/default/index.html HTTP/1.1
Host: 10.151.59.2:10080
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: NID=67=BUovympli30FPUZ9xJ0N8heI22xH4wL8uuy3YPL3n7EmTtSpQ7nQ_VJS0zgGnWbXVmrHAfU1CIER3HhPvGDfkBODxOoKQsXpuCE6punpkrw-WhRZmg7duiZntwqzgjHh; PREF=ID=55ee18705b919343:U=3649ea9bd9b0a9cc:FF=0:TM=1432904549:LM=1432904571:S=7VeFNsfwhAARESRp
DNT: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36
X-Client-Data: CIa2yQEIpLbJAQiptskBCMS2yQEI6YjKAQj9lcoB
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 3833
Content-Type: text/html
Date: Fri, 29 May 2015 13:41:45 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
P3P: policyref="/w3c/p3p.xml", CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"
Pragma: no-cache
X-Powered-By: Servlet/3.0
来自另一台机器上运行的服务器的响应:
GET /myProject/apps/services/preview/eMeeting/common/1.0/default/index.html HTTP/1.1
Host: 10.150.20.51:9080
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: NID=67=BUovympli30FPUZ9xJ0N8heI22xH4wL8uuy3YPL3n7EmTtSpQ7nQ_VJS0zgGnWbXVmrHAfU1CIER3HhPvGDfkBODxOoKQsXpuCE6punpkrw-WhRZmg7duiZntwqzgjHh; PREF=ID=55ee18705b919343:U=3649ea9bd9b0a9cc:FF=0:TM=1432904549:LM=1432904571:S=7VeFNsfwhAARESRp
DNT: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36
X-Client-Data: CIa2yQEIpLbJAQiptskBCMS2yQEI6YjKAQj9lcoB
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 3833
Content-Type: text/html
Date: Fri, 29 May 2015 13:43:11 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
P3P: policyref="/w3c/p3p.xml", CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"
Pragma: no-cache
X-Powered-By: Servlet/3.0