Support Article
Create Work action mangles parameters that require unicode
SA-45281
Summary
The Create Work action mangles parameters that require unicode.
On a site using the Japanese language pack, there is a link to a Create Work action. The first parameter, serverName, is a property that shows up as a set of character codes instead of Japanese.
Error Messages
Not Applicable
Steps to Reproduce
1. Use a site with the Japanese language pack installed.
2. In a section, create a link.
3. In the Actions tab of the link, add a Create Work action to a flow that takes at least one parameter as shown here:
4. Notice that the parameter should have a value in Japanese and the flow should display the parameter. The value displayed is not Japanese nor anything else recognizable.
Root Cause
A defect in Pegasystems’ code or rules where the fix for BUG-219306 introduced the problem.
Resolution
Perform the following local-change:
In userworkform, add a local copy of the function pega.desktop.createNewWork from pega_desktop_api and make the following one-line change to the portion of the function shown below:
if (strFlowName && strFlowName != "") {
oSafeURL.put("FlowType", strFlowName);
// 09/27/2012 TASK-118705 GUJAS1 Add flow parameters to the safe URL.
var paramKeys = "";
if (flowParams && flowParams != '') {
// At this point, each parameter is encoded,
//the complete string can be split on '&'
var oParams = flowParams.split("&");
for (var i = 0; i < oParams.length; i++) {
if (oParams[i] != '') {
var oParamNMPair = oParams[i].split("=");
// Unescaping first will convert the %2B to + which will be replaced by space.
//Avoid this by replacing the + with space and then unescaping
/* Unescape is deprecated, so changed it with decodeURIComponent : kumad1 */
oSafeURL.put(oParamNMPair[0], decodeURIComponent(oParamNMPair[1].replace(/\+/g, " ")));
/*comment out the line below (as shown), and insert the line above*/
//oSafeURL.put(oParamNMPair[0], oParamNMPair[1].replace(/\+/g, " "));/*BUG-219306 removing decodeURIComponent as decoded values are put in oSafeURL and same is later passed to SafeURL_createFromURL api in which url is splitted based on &*/
paramKeys += oParamNMPair[0] + "&";
}
}
//Adding a paramKey string to be split at server-side, so that RecentGadget can have the custom parameters also. JAINB1- BUG-129094.
paramKeys = paramKeys.substring(0, paramKeys.lastIndexOf("&"));
if (paramKeys != "" || paramKeys != null) {
oSafeURL.put("flowParamNames", paramKeys);
}
}oSafeURL.put("FlowType", strFlowName);
// 09/27/2012 TASK-118705 GUJAS1 Add flow parameters to the safe URL.
var paramKeys = "";
if (flowParams && flowParams != '') {
// At this point, each parameter is encoded,
//the complete string can be split on '&'
var oParams = flowParams.split("&");
for (var i = 0; i < oParams.length; i++) {
if (oParams[i] != '') {
var oParamNMPair = oParams[i].split("=");
// Unescaping first will convert the %2B to + which will be replaced by space.
//Avoid this by replacing the + with space and then unescaping
/* Unescape is deprecated, so changed it with decodeURIComponent : kumad1 */
oSafeURL.put(oParamNMPair[0], decodeURIComponent(oParamNMPair[1].replace(/\+/g, " ")));
/*comment out the line below (as shown), and insert the line above*/
//oSafeURL.put(oParamNMPair[0], oParamNMPair[1].replace(/\+/g, " "));/*BUG-219306 removing decodeURIComponent as decoded values are put in oSafeURL and same is later passed to SafeURL_createFromURL api in which url is splitted based on &*/
paramKeys += oParamNMPair[0] + "&";
}
}
//Adding a paramKey string to be split at server-side, so that RecentGadget can have the custom parameters also. JAINB1- BUG-129094.
paramKeys = paramKeys.substring(0, paramKeys.lastIndexOf("&"));
if (paramKeys != "" || paramKeys != null) {
oSafeURL.put("flowParamNames", paramKeys);
}
CAVEAT: This will restore the previous bug, which manifested in that if there was an embedded ampersand ("&") in the string, the code would truncate the string at that point, believing it to be metadata. In a double-byte character set, there should be no embedded "&" characters, and so this change should restore correct behavior. The bug will be fixed in a future release.
Published March 13, 2018 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.