Advertisement:

Author Topic: Can't post unicode emoji  (Read 3578 times)

Offline Gluz

  • Native Language Support Specialist
  • Sr. Member
  • *
  • Posts: 843
  • Gender: Male
    • Al-eXs on GitHub
Re: Can't post unicode emoji
« Reply #20 on: June 18, 2017, 06:34:47 PM »
The fix for 2.0.10+ pretty much is the same as for 2.1 beta 3, but it would work only if the forum is in UTF8. I see that in the github and tested in my test forum, I already passed that into my live forum as well.

https://github.com/SimpleMachines/SMF2.1/commit/5b73e8dcc330dfb4d87fec54b7a5518a46272fbf

Basically in /Themes/all_themes_that_have_it/Post.template.php search for all instances of:
Code: [Select]
.php_to8bit().php_urlencode()
And delete that part, with it, the previews should work.
Need help with PHP, HTML, CSS, Themes or MODs?

Quote
Think in spanish, habla en inglés.

Offline feline

  • SMF Hero
  • ******
  • Posts: 1,615
  • Gender: Female
    • Product developer site
Re: Can't post unicode emoji
« Reply #21 on: June 19, 2017, 02:24:41 AM »
Better choice ..

replace:
Code: [Select]
.php_to8bit().php_urlencode()
with:
Code: [Select]
.html_entity_decode.php_urlencode()
That works perfect ...
PortaMx has released the official release of PortaMx-Forum 1.0 with a built in SEF engine, a integrated Portal and full support for the EU Cookie Law.
Follow us on our Community


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 67,437
    • Arantor on GitHub
Re: Can't post unicode emoji
« Reply #22 on: June 19, 2017, 11:46:58 AM »
Don't you want brackets on the decode call?
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline feline

  • SMF Hero
  • ******
  • Posts: 1,615
  • Gender: Female
    • Product developer site
Re: Can't post unicode emoji
« Reply #23 on: June 19, 2017, 04:00:43 PM »
No .. this I have tested with a Android handy/tablet and a MS Lumia ..
Works perfect ...  ;)
PortaMx has released the official release of PortaMx-Forum 1.0 with a built in SEF engine, a integrated Portal and full support for the EU Cookie Law.
Follow us on our Community


Offline albertlast

  • Development Contributor
  • Jr. Member
  • *
  • Posts: 138
Re: Can't post unicode emoji
« Reply #24 on: June 19, 2017, 04:34:22 PM »
what is the motivation for doing this decode/encode stuff?
Because this stuff cost cpu and traffic.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 67,437
    • Arantor on GitHub
Re: Can't post unicode emoji
« Reply #25 on: June 19, 2017, 06:13:00 PM »
I'm not sure but I genuinely don't see how that snippet works correctly. Maybe it ends up doing the same as the 2.1 equivalent change ;D
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Gluz

  • Native Language Support Specialist
  • Sr. Member
  • *
  • Posts: 843
  • Gender: Male
    • Al-eXs on GitHub
Re: Can't post unicode emoji
« Reply #26 on: June 20, 2017, 01:33:13 AM »
It doesn't, it throws JavaScript error about html_entity_decode not being defined if used without brackets, and that is not a function with brackets.

That part it's failing to do anything.

If you just use the fix for 2.1, it works the same but without errors.
Need help with PHP, HTML, CSS, Themes or MODs?

Quote
Think in spanish, habla en inglés.

Offline feline

  • SMF Hero
  • ******
  • Posts: 1,615
  • Gender: Female
    • Product developer site
Re: Can't post unicode emoji
« Reply #27 on: June 20, 2017, 02:01:47 AM »
Prewiev Screenshot without html_entity_decode (not_correct)

Preview Screenshot width html_entity_decode (correct)

More questions?
PortaMx has released the official release of PortaMx-Forum 1.0 with a built in SEF engine, a integrated Portal and full support for the EU Cookie Law.
Follow us on our Community


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 67,437
    • Arantor on GitHub
Re: Can't post unicode emoji
« Reply #28 on: June 20, 2017, 03:49:48 AM »
I'm just struggling to understand how a JavaScript property can be called as a function without using the operator to tell it to use it as a function.

In other words, as gluz said.

Now, if you had the brackets in there as I suggested, I could see it maybe working.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Gluz

  • Native Language Support Specialist
  • Sr. Member
  • *
  • Posts: 843
  • Gender: Male
    • Al-eXs on GitHub
Re: Can't post unicode emoji
« Reply #29 on: June 20, 2017, 04:08:43 AM »
That preview without html_entity_decode have php_urlencode or not?

Where it's defined html_entity_decode in SMF? because the JavaScript console says it's not defined.

With the github fix it displays the Emojis fine in a brand new SMF install, and with your code it displays the Emojis but also generate that error in the JavaScript console.
Need help with PHP, HTML, CSS, Themes or MODs?

Quote
Think in spanish, habla en inglés.