About this question
My question is, some records contains "&" in fields (or accents). They have to. Those fields are automatically updated and used as mapping values, so I cannot really control them. When record is saved, "&" become "&". Then record is updated and value become "&". Then "&" and so on ... Correct them manyally will just do the same. It's causing me 2 problems :my values get false (and this value is used for mapping)at some point the value is getting too large and update fails. Example : a record with "Johns & Johns", automatically created. If a lead is created with "Johns & Johns", some apex code should value a lookup with this record. But when I save it, value becomes "Johns & Johns". Then "Johns & Johns".Same hing with accents that are registered with html values "é" then "é" and so on.
Edit 2019-11-15 Since it could be some trigger code, i searched and found this function, the only on used on those field
public static String specialCharHandler(String f){ String str = f.escapeHtml4(); system.debug('str::-->>' + str); str = str.replace(' ',' '); system.debug('str22::-->>' + str); return str; }
Ok, i made some tests and this is the cause of the behavior. Thanks cropredy for helping me understand the problem. How to use ampersands & Would have vote for your comment if it was an answer ;)