Skip to content

[5.x]: Emoji shortcodes in internal values in plain text fields get encoded for display #16917

@jaspertandy

Description

@jaspertandy

What happened?

Description

Currently there's a block on encoding emoji on the way in - Craft checks for mb4 capabilities before storing a value. However, it does not check these values when displaying the internal value in the CMS UI. As as result, the encoded value will get saved in anyway, even if you don't need or want this. This PR stops the encoding from happening when displaying an internal value too, so that the value always stays unencoded on supported databases which, in my opinion, is the correct behaviour.

Steps to reproduce

  1. Create a plain text field on a database that supports mb4
  2. Save the value :x: in the field (just the value - github helpfully also automatically converts the shortcode!)
  3. View the entry in elements_sites - you will notice that the value is still :x:
  4. Load the entry in the CMS UI - you will notice that the value is now ❌ but the value in the database is unchanged

Expected behavior

The value displayed at step 5 above is still :x:, and not ❌

Actual behavior

The value is ❌

Craft CMS version

5.x

PHP version

No response

Operating system and version

No response

Database type and version

mysql 8.4, utf8mb4-enabled tables

Image driver and version

No response

Installed plugins and versions

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions