Skip to content
Advertisement

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..

https://hotemoji.com/eight-spoked-asterisk-emoji.html#:~:text=%E2%9C%B3%EF%B8%8F%20Meaning%20%E2%80%93%20Eight%2DSpoked%20Asterisk,a%20list%20as%20bullet%20points.

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)
);

};

Advertisement

Answer

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}'; 
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement