Encode Message to UTF-8
We have a requirement to encode sms message to UTF-8. Please suggest steps to perform.
***Edited by Moderator Rupashree S. to add Capability tags***
To see attachments, please log in.
We have a requirement to encode sms message to UTF-8. Please suggest steps to perform.
@TejaP544 - Using javascript we can make use of below function.
encodeURIComponent("Encode to UTF-8");
Thank you.
@Priyanka Boga Thanks, When i used below java code and tested in an activity, the code is not returning in UTF-8 format.. any other changes need to be done?
String encodedValue = ""; try{ encodedValue = java.net.URLEncoder.encode(value, "UTF-8"); } catch (java.io.UnsupportedEncodingException e) { oLog.error("Encoding format not supported : " + e.getMessage()); } return encodedValue;
@TejaP544 - Syntax wise its correct . This code is used in Function rule or in Activity? when returning encodedValue where its getting captured or stored? Before return can we try placing oLog.info to verify what is value after encoding.
Thank you.
@Priyanka BogaWe have inbuilt function with this code and below is the function name
pzControl • pzURLEncodeString
We used this in an activity, in step property set.
Param.Message = "This is a sample SMS Message"
Param.EncodedMessage = @(Pega-IntegrationEngine:OauthUtilities).pzURLEncode(Param.Message)
This is the output we got when we run that activity: which is not in UTF-8 format. Please let us know if any changes need to be done.
EncodedMessage | This%20%20is%20a%20sample%20SMS%20Message |
Message | This is a sample SMS Message |
@TejaP544 - May be you are checking for wrong encoding i feel, UTF-8 encodes only special characters to ASCII code and the letters will be displayed as same. For encoding please try with Base64 encoding.
Function name : Base64Encode
Property-set : Param.EncodedMessage = @Base64Encode(Param.Message)
Thank you.
Question
Question
Question Solved
Question
Question Solved
Question Solved
Question Solved
Question
Question
Question Solved
Pega Collaboration Center has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.