nurupo / ProjectTox-Qt-GUI

A cross-platform front end for ProjectTox Core library, written in C++11 with use of Qt5
GNU General Public License v3.0
343 stars 117 forks source link

Empty messages on some unusual utf8 #118

Open hilesaz opened 10 years ago

hilesaz commented 10 years ago

In InputTextWidget::keyPressEvent a message that starts with U+FFFC will be passed through toPlaintext normally (so not get culled) but will end up as an empty

when passed through toHtml.

nurupo commented 10 years ago

Looks like QTextEdit treats U+FFFC as a special character and there is no way to escape it.

Anyway, there are many special and noncharacter characters in utf8, so it makes sense to sanitize user input.

msteinbeck commented 10 years ago

Anyway, there are many special and noncharacter characters in utf8, so it makes sense to sanitize user input.

Which spacial characters do you mean? That one listed here? http://de.wikipedia.org/wiki/Unicodeblock_Spezielles

nurupo commented 10 years ago

Well, U+FFFC is used internally by QTextEdit engine and there seem to be no workaround for that.

Which spacial characters do you mean?

Like the object replacement character U+FFFC and noncharacters from the Arabic block (U+FDD0 - U+FDEF), though I'm sure there are still many others.

That one listed here? http://de.wikipedia.org/wiki/Unicodeblock_Spezielles

Can't read Deutsch, but yes, some of them.

msteinbeck commented 10 years ago

Can't read Deutsch, but yes, some of them.

oops :D

I think the most simple fix would be to replace all "U+FFFC" inside the event with an empty string. I already have a patch for this but sending a PR will end in a (small) merge conflict with #120.