Just put some emojis like those ones 😛😆 and preview the message using the preview button, it will generate an empty message error.
Just noticed it today so i haven't investigated where the code is failing exactly.
I'm pretty sure it's a problem with uriencode/decode not being able correctly decode the emojis which are longer entities than usual.
A single 😛 translate, once uriencoded, in the preview;xml query as: %ED%A0%BD%ED%B8%9B (message field)
Preview from quick reply or preview from full reply? Modified 2.0.15 or not?
You can test it just here it fails as well as on my very modified forum.
preview in quickreply works fine since once you hit the preview button you are redirected to the full editor with a correctly parsed string. It's the uriencoding when sending the XML which is not working correctly i believe. The message field looks very odd, seems almost (6 bytes vs 4) twice as long as it should.
The tongue emoji posted above should encode to: %f0%9f%98%9b but as far as i can tell it's %ED%A0%BD%ED%B8%9B in the preview;xml message field.
My take would be that String.prototype.php_to8bit is failing to correctly encode 4bytes UTF-8 characters
Similar to https://github.com/SimpleMachines/SMF2.1/issues/3448
If fixed it in Post.template.php by replacing
x[x.length] = textFields[i] + \'=\' + document.forms.postmodify[textFields[i]].value.replace(/&#/g, \'&#\').php_to8bit().php_urlencode();
with
x[x.length] = textFields[i] + \'=\' + encodeURIComponent(document.forms.postmodify[textFields[i]].value.replace(/&#/g, \'&#\'));
It's a quick fix for the standard editor (i do not use wysiwyg) and my board is UTF-8 i did not check it's impact on ISO based boards.
Quote from: butch2k on January 19, 2018, 06:53:25 AM
You can test it just here it fails as well as on my very modified forum.
Does not to me...
:) ;) :D ;D >:( :( :o 8) ??? ::) :P :-[ :-X :-\ :-* :'( O:) :laugh:
those are smileys not emoji's from your phone.
Oh. Right.
😑
Sorry, tried again - Does it here too.
It's the .php_to8bit().php_urlencode() which incorrectly encode the emojis.
btw does any of you know why this sequence was used rather than just encodeURIComponent() ? was it for the ISO encoded forums ?
Quotewas it for the ISO encoded forums ?
Yes.
php_to8bit() could be modified to be a straight pass-through if utf8 is enabled. It already differentiates between charsets,
My test forum on ISO shows the preview fine but without the emoji.
This was reported a few times & a fix is targeted for 2.0.16 - I am going to close the dupes & keep one open:
https://www.simplemachines.org/community/index.php?topic=569620.0