1

I have one import object which stores the record from data loader then I run my apex class which pick the record from import object and assign data to the respective fields in new object. When I try to run my class it is creating multiple special character from one special character. for e.g. when I run the class it is converting surname from O'ROURKE to O'ROURKE I have added replaceAll('[^a-zA-Z0-9\\s+]', '') but it is not removing 39 from surname. Please help.. stuck on this issue since so long

1

&#x; is a character escape. XML requires this in order to not break protocol when certain characters, such as ', <, and > are included in the text that should be preserved. However, this shouldn't happen unless these characters are already in the data you're trying to upload. Ideally, you should fix your data file. That said, if you need to fix those characters, use String#unescapeHtml4, as in:

record.LastName = record.LastName?.unescapeHtml4();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.