'How to prevent ✳ symbol converting to emoji
I have a problem where my ✳ (Eight-Spoked Asterisk) symbol is converting to emoji on iOS/android devices..
Can somebody help me on what to do to prevent convertion of normal symbol ✳ to emoji asterisk! I am working with react/typescript.
Example:
I want 1234 ✳✳✳✳ ✳✳✳✳ 5678 - this is fine on desktop
I dont want 1234 1234 ✳️✳️✳️✳️ ✳️✳️✳️✳️ 5678 - this happens on ios/android
Thanks
EDIT - Function that does replacement:
export const hideDigits = (value: string) => {
const parsedValue = value.slice(0, 4) + value.slice(4, value.length -4).replace(/\d/g,'\u2733') + value.slice(value.length -4);
return (
normalizeVoucherCode(parsedValue)
);
};
Solution 1:[1]
Solved it like this for anyone who is wondering!
//Force ?? to never be parsed as emoji with variation selector \u{FE0E}!
const textSymbol = '\u{2733}\u{FE0E}';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | HexXx |
