在IBM Connections(版本4.0和4.5)中,我将问题底部显示的JSON发布到活动流。
数据中的“标题”字段使用自定义标题模板,在“com.ibm.lconn.news.nls.templatePlaceholders.properties”文件中定义为:
GENERAL.kudos.boards.entry.created={actor} created the {activityEntry} entry in the {Target} board.
处理标题模板,但在标题出现在Connections UI中之前,会对各种字符(例如&符号和引号)进行双重编码。
例如,下面显示的JSON会在Connections UI中生成一个活动流条目:
Scott Leis created the Entry 9 & test entry in the Scott's Test Activity board.
如果我发出GET请求来检查服务器上的JSON,那么包含&符号的条目标题的一部分就像这样,并且&符号是双编码的:
Entry 9 & test
如何防止此类字符被双重编码?
原始JSON如下
我还尝试在发布之前在JSON中将&符号编码为&
,但这会导致它在UI中进行三重编码。
{
"target":{
"objectType":"task-list",
"id":"35bf524b-1651-48d4-afea-e8a428f8f1ff",
"displayName":"Scott's Test Activity",
"url":"https://server.company.net.au/kudosboards/#board/35bf524b-1651-48d4-afea-e8a428f8f1ff"
},
"generator":{
"id":"kudos"
},
"actor":{
"id":"@me"
},
"connections":{
"broadcast":"false",
"isPublic":"true",
"rollupid":"urn:lsid:lconn.ibm.com:activities.unknown:5b824624-01be-49bc-9485-d75f09ba0098",
"saved":"false",
},
"title":"${kudos.boards.entry.created}",
"updated":"2014-04-23T03:50:00.000Z",
"object":{
"summary":"",
"objectType":"entry",
"id":"5b824624-01be-49bc-9485-d75f09ba0098",
"displayName":"Entry 9 & test",
"url":"https://server.company.net.au/kudosboards/#board/35bf524b-1651-48d4-afea-e8a428f8f1ff"
},
"verb":"post"
}