When using Arcade for labeling, the output is interpreted as HTML. In this case, the HTML reserved character <
is in the field value, and its presence is messing up the HTML interpretation and display of the field value.
Knowing that Arcade labeling is interpreted as HTML, one can create a label expression that encodes the HTML reserved characters to their appropriate HTML entity.
var htmlEncode = Dictionary(
'"', """,
"'", "'",
"&", "&",
"<", "<",
">", ">",
);
var rawString = "Value <1 or >5. It's me.";
for(var char in htmlEncode) {
rawString = Replace(rawString, char, htmlEncode[char]);
};
return rawString
returns
Value <1 or >5. It's me.
<
to prevent it from being interpreted as an HTML control character. Try:"(CH<SUB>4</SUB> " + Replace($feature.Methane,"<","<") + " ppm)"