You need to sign in to do that
Don't have an account?
Vishal Tiwari 36
Apex Strings : Pipe symbol (|) is converted to | in string variable while querying
Hi All,
I'm trying to query a field on Object__c which stores information like (1001|01).
Example:
Exception Message is shown as below:
Below are the list of things I have already tried to stop pipe symbol from getting converted into it's Unicode:
1. unescapeHtml4()
2. EncodingUtils.urlDecode();
3. replace() and replaceAll() methods to convert | to pipe symbol dynamically
All the above ways failed to get the required results.
Any other help or direction would be appreciated.
Thank you
I'm trying to query a field on Object__c which stores information like (1001|01).
Example:
String str = '\'1001|01\''; List<Object__c> recordList = [SELECT ID FROM Object__c WHERE Field__c includes (str) LIMIT 50000];
Exception Message is shown as below:
"common.apex.runtime.impl.ExecutionException: expecting a right parentheses, found '|'"
Below are the list of things I have already tried to stop pipe symbol from getting converted into it's Unicode:
1. unescapeHtml4()
System.debug(str.unescapeHtml4());
2. EncodingUtils.urlDecode();
String str = '\'1001%7C01\''; // %7C is equivalent to pipe (|) symbol System.debug(EncodingUtil.urlDecode(str, 'UTF-8'));
3. replace() and replaceAll() methods to convert | to pipe symbol dynamically
All the above ways failed to get the required results.
Any other help or direction would be appreciated.
Thank you
Try this one,it may help you
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi
I tried a similar code in Anonymous block and it works I also see you also reached out on https://salesforce.stackexchange.com/questions/357132/apex-strings-pipe-symbol-is-converted-to-124-in-string-variable-while-q which has been addressed by sfdcfox according to which the issue could be else where in the code
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you