milesj / decoda

A lightweight lexical string parser for BBCode styled markup.
MIT License
196 stars 52 forks source link

Emoticons not parsed when having the   next to it #114

Closed sauls closed 8 years ago

sauls commented 8 years ago

For example these are not parsed.

 :);nbsp; :);nbsp;:D ;nbsp;:)

;nbsp;:);nbsp;:);nbsp;:);nbsp;:) and so on ...

The string I get before the escapeHtml is: ":) :) :) :) :)" and after the escapeHtml is executed the string becomes as ":)nbsp;:)nbsp;:)nbsp;:)nbsp;:)" so the emoticons are not parsed at all...

milesj commented 8 years ago

escapeHtml() does not convert spaces to  . Are you sure they don't already exist in the string before being sent to Decoda?

Emoticons require whitespace around the ASCII to work correctly. At most, I could remove  , but that should probably be done on your end.

sauls commented 8 years ago

Well I think it does exists before the escaping, it all comes from wysiwyg editor, when posting from html window i guess it posts with the   and then I post in raw data everythinh is working well.

Well maybe you are right, I should clean the string before parsing it.

QuentinPi commented 8 years ago

Sorry for this new response but if I understand correctly, if the emoticons are separated by special spaces (such as these : https://fr.wikipedia.org/wiki/Aide:Liste_de_caract%C3%A8res_sp%C3%A9ciaux#Espaces_fine_et_ins.C3.A9cable), then the emoticons are not parsed ? So we need to transform the special spaces before sending the text to Decoda ?