Telegram Web K with changes to work inside I2P
https://web.telegram.i2p/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
462 B
9 lines
462 B
export default function encodeEntities(value: string) { |
|
return value.replace(/&/g, '&').replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, (value) => { |
|
const hi = value.charCodeAt(0); |
|
const low = value.charCodeAt(1); |
|
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';'; |
|
}).replace(/([^\#-~| |!])/g, (value) => { // non-alphanumeric |
|
return '&#' + value.charCodeAt(0) + ';'; |
|
}).replace(/</g, '<').replace(/>/g, '>'); |
|
}
|
|
|