bsidelinger912 / shiitake

React Line clamp that won't get you fired
MIT License
100 stars 22 forks source link

alt-codes/emoticons/emojis and after are removed #31

Open lars1702 opened 5 years ago

lars1702 commented 5 years ago

Hi! Please redirect me if this issue has already been addressed somewhere, I could not find it. Also please tell me if this is lacking information you need.

As far as i can tell Shiitake will remove special characters, including all characters following it. From what i can gather, special characters that have a char-length of 2 or more are removed, along with everything after. At least those I have tested.

The following test-string Cool! 😀 .😀 This is super cool( ͡° ͜ʖ ͡°) yo (•⚗ ৺⚗•) ᕕ ༼⌐■-■༽ᕗ ????????? will only render Cool! (with the final empty-space) when used with Shiitake.

The behaviour repeats itself with later special characters, like Lennyface ( ͡° ͜ʖ ͡°), bulletpoint , and so on. Just to be clear on this, if I remove all the special characters, everything is rendered. I have also tested other strings and emoticons. Æ, Ø and Å - three Norwegian letters, are rendered.

I'm not sure, but I think the issue might relate to the length of each of the special characters and how length is handled. All the emoticons have a char-length of 2 or more, while Æ,Ø and Å, for instance, have a char length of 1. "😀".length === 2 // true "Æ".length === 1 // true

I haven't found time to check your src and see if i can find a solution.

lars1702 commented 5 years ago

I've attempted to reproduce in the demo. I realised that the steps are only possible to reproduce when number of lines are set to 1. Regardless of styling. Should be reproducible.

'Co😀ol! .😀 With lines={1}, should render only an ellipsis. Cool! 😀 .😀 Should render Cool! Nice where the emoticon is placed within the text