We have a before insert/update trigger on the Standard Account object which populates a custom field External_ID__c. This field has the Unique (case in-sensitive) and External ID options enabled
The trigger takes the Account LastName (Standard), SSID__c (custom text field), Producer__c (custom text) fields and concatenates them into External_ID__c as follows:
acc.External_ID__c = acc.Producer_ID__c + acc.LastName + acc.SSID__c;
The LastName field will almost always have Korean characters.
We have a record with following values:
Producer__c = SC0022999 SSIC__c = 1752110 LastName = 교촌에프앤비㈜
While trying to insert the below record, Salesforce.com threw an error saying the External_ID__c calculated is not unique:
Producer__c = SC0022999 SSIC__c = 1752110 LastName = 교촌에프앤비(주)
Notice the last character in the existing record: ㈜ is different from the one we're trying to insert: (주) ==> Korean character within parentheses. Arguably, the combination represent the same meaning (or whatever) in Korean. However, they are essentially different characters and hence should not be treated as unique. Or should it? We looked at the Debug logs for that particular field and found nothing bizarre.
While we're glad that Salesforce.com thought they are the same characters, we're kind of confused if this kind of comparison is correct - where there seems to be some translation involved? Another confusing aspect is that, all of the below returned false
String a = 'SC0022999교촌에프앤비㈜1752110'; String b = 'SC0022999교촌에프앤비(주)1752110'; System.debug(a==b); System.debug(a.equals(b)); System.debug(a.equalsIgnoreCase(b));