简体   繁体   中英

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..<\/i>

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

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}'; 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM