Loading

Salesforce Formula Functions Treat Surrogate Pair Characters as Two Characters

Data pubblicazione: Jun 10, 2026
Descrizione

Although surrogate pair characters (for example, "𠮟" and "𠀋") display as 1 character, Salesforce formula string functions (LEFT, LEN, MID, RIGHT, and others) treat them as 2 characters internally.

  • LEN("𠮟")` returns 2, not 1.

Extracting the high surrogate with `LEFT("𠮟", 1)` results in "?" because the character cannot be interpreted correctly.

Surrogate pair characters consist of a combination of two values: a "high surrogate" and a "low surrogate." Consequently, the Salesforce formula engine counts these as two separate characters.

For example, a Salesforce admin building a formula to count characters in a text field containing Japanese kanji extended characters notices that LEN() returns an unexpected count.

Risoluzione

This article explains how to correctly handle surrogate pair characters in Salesforce formulas, which count each such character as two characters.

How to Handle Surrogate Pair Characters in Formulas

To correctly manipulate surrogate pair characters in formulas, you must treat them as two characters.

For example, to retrieve the surrogate pair character "𠮟", use the following syntax: `LEFT("𠮟", 2)`

Risorse aggiuntive

This behavior is also observed in the Apex String class. The following article provides more details.

Numero articolo Knowledge

005166849

 
Caricamento
Salesforce Help | Article