Magento2: Meta description and keywords transform to html entities for non latin/cyrilic characters in category and product pages

Created on 28 Aug 2017  路  10Comments  路  Source: magento/magento2

When setting up meta keywords and description in the categories and in every product, all non latin characters transform to html entities, but not the title.

Preconditions

  1. Magento CE 2.1.8
  2. PHP 7.0.22
  3. Server version: MySQL 5.6.35
  4. el_GR language pack or any other non latin language

Steps to reproduce

Choose and enable a non latin language pack, ie Greek

  1. setup the meta keywords and description for a category and a product
  2. view page source

Expected result

All keywords appear as they should and category pages are "read" by google

Actual result

All non latin words are html entities

I have double checked the data table entries, everything looks as it should.

Note: The meta title is shown correctly, but also everything works fine on the homepage.

Fixed in 2.1.x Fixed in 2.3.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x bug report

All 10 comments

For reference: this bug has been reported numerous times before.
Please see the following issues, for example: #5299, #4861, #2295
Still not fixed, it seems.

@fouli86, thank you for your report.
We were not able to reproduce this issue by following the steps you provided.
Please provide more details regarding your environment, or try to reproduce this
issue on a clean installation.

Hello,
Database Server:
Server: Localhost via UNIX socket
Server type: MySQL
Server version: 5.6.35 - MySQL Community Server (GPL)
Protocol version: 10
Server charset: UTF-8 Unicode (utf8)

Web Server:
cpsrvd 11.64.0.39
Database client version: libmysql - 5.1.73
PHP extension: mysqli, curl, mbstring
PHP version: 5.6.30

I am using the language pack found here
I can't think of other details to provide you. Please do ask me for anything more specific. I haven't got the time yet to upgrade to the 2.1.9 version, in order to check if the problem still exists. I can send you my url in a private message or something, so that you can all better understand the issue.

Thanks in advance

@fouli86, may you, please, describe "expected result" more clear

Sure! Let me be more clear with the following print screens:
Here is the Search Engine Optimization of a category on the backend
image

The expected result would be:
image

But....the actual page source is:
image

All words written in Greek are HTML entities, but note that the title is shown correctly (in greek characters). I have also noticed that whenever a category has no keywords and description, it uses correctly the keywords of my homepage.

I'm afraid I can't be more clear, but I really appreciate your help.

Thank you

@orlangur: because it causes the html to be larger in filesize then if the characters are outputted just as is, in utf-8 format.

In case anyone is interested, the entity encoding happens on this line:
https://github.com/magento/magento2/blob/4b56264/lib/internal/Magento/Framework/View/Page/Config.php#L229

I think the call to htmlentities should get removed here, it's not the task of this class to already start encoding text. If there needs to be some encoding/escaping it should happen when outputting the html, so in a Block or in a phtml file.

Internal ticket to track issue progress: MAGETWO-83024

Hi @fouli86. Thank you for your report.
The issue has been fixed in magento/magento2#12955 by @dverkade in 2.3-develop branch
Related commit(s):

  • c49c52a08cb5d34e648ebf21da9d9235c14773ec

The fix will be available with the upcoming patch release.

Hi @fouli86. Thank you for your report.
The issue has been fixed in magento/magento2#12956 by @dverkade in 2.1-develop branch
Related commit(s):

  • 85db3a0b195857541cae8ceec99420e2f977a431
  • 66d4d4ef58633b2dd2f8df4f0dc08cecdaee9f01

The fix will be available with the upcoming patch release.

Was this page helpful?
0 / 5 - 0 ratings