Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't save emoji in custom product options #12058

Closed
archonkulis opened this issue Nov 6, 2017 · 5 comments
Closed

Can't save emoji in custom product options #12058

archonkulis opened this issue Nov 6, 2017 · 5 comments
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@archonkulis
Copy link

Preconditions

  1. Magento version 2.1.6 ( it doesn't matter actually )
  2. PHP 7.0
  1. Mysql 5.6

Steps to reproduce

  1. Add some custom options to product ( text )
  2. Go to product in front-end, input some emoji in that text field, e.g. "123 😍"
  3. Add to cart

Expected result

  1. Either cart would render fine or show an error that specific emoji insertion is not supported

Actual result

  1. The cart is empty -> https://prnt.sc/h6v033

My observations

The issues seem to be because Magento uses utf8_general_ci collation for the tables and also connection. If I try to manually insert "123 😍" in the utf8_general_ci table in the database, it doesn't allow it and shows following error:

[HY000][1366] Incorrect string value: '\xF0\x9F\x98\x8D' for column 'value' at row 1

Everything would be good if Magento wouldn't serialize ( or json_encode in the newest version ) the custom_options. ( well, not good anyway, but at least the cart would render fine, just the options would be truncated )

For example, when Magento inserts the "123 😍" in the quote_item_option.vale table, it becomes:

a:5:{i:0;s:8:"123

As you can see, the string is corrupted at the end ( it truncates the string at the place where the emoji is )

I think that even if you do not plan to switch from utf8_general_ci to some other encoding which could solve this problem, you should still try to either show an error message in the front-end for the user or at least silently remove that emoji so that at least the cart would render fine.

Let me know what you think.

Thanks.

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Nov 6, 2017
@magento-engcom-team
Copy link
Contributor

@archonkulis, thank you for your report.
We've created internal ticket(s) MAGETWO-83334 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Nov 6, 2017
@KarlDeux
Copy link

Got this! (think so)

@KarlDeux
Copy link

Fixed on #12253

@okorshenko
Copy link
Contributor

The issue has been fixed and delivered to 2.2-develop branch. Will be available with upcoming patch release

@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Nov 28, 2017
@magento-engcom-team
Copy link
Contributor

Hi @archonkulis. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1296 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

4 participants