Make WordPress Core

Opened 8 weeks ago

Last modified 7 days ago

#64318 new defect (bug)

↗ should not be replaced by Twemoji

Reported by: joen's profile Joen Owned by:
Milestone: 7.0 Priority: normal
Severity: normal Version: 4.2
Component: Emoji Keywords: has-patch
Focuses: Cc:

Description

At present, if you type ↗, a unicode glyph, in a WordPress post, it is converted to a Twemoji: ↗️. But those are two different things, very intentionally so, just like → is different from ➡️.

At present if you want to avoid having the ↗ glyph replaced with a twemoji, you either have to disable the set entirely, or add a CSS class, wp-exclude-emoji in order to safeguard the glyph.

From some conversations with others, this replacement of ↗ (and presumably also south east, south west, north west arrows) appears to be a recent change in WordPress, not present in 6.8 and happening sometime between September 3 and now.

Attachments (1)

64318-exclude-math-arrows.diff (1.2 KB) - added by iflairwebtechnologies 8 weeks ago.
should not be replaced by Twemoji

Download all attachments as: .zip

Change History (13)

#1 @tyxla
8 weeks ago

  • Component changed from General to Emoji

@iflairwebtechnologies
8 weeks ago

should not be replaced by Twemoji

#3 @iflairwebtechnologies
8 weeks ago

  • Keywords has-patch added
  • Version set to trunk

This patch prevents mathematical arrow symbols such as ↦ ↤ ↥ ↧ from being incorrectly converted into Twemoji. These characters belong to the Mathematical Operators block and represent functional or logical notation, not emoji. Replacing them with Twemoji changes the meaning of the text, which is especially problematic in technical, mathematical, or academic content.
The patch introduces:

  • PHP safeguard in wp_staticize_emoji() to explicitly skip math arrow characters.
  • JavaScript regex fix in wp-emoji.js to exclude the Unicode range U+21A6–U+21AA, ensuring consistent behavior across both backend and frontend.

This restores the expected behavior seen in WordPress 6.8 and earlier, ensuring that math symbols remain unchanged and are not interpreted as emoji.

#4 @westonruter
8 weeks ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from Awaiting Review to 6.9.1

@iflairwebtechnologies I tried applying your patch but it doesn't apply. The patch seems to be applying against a non-existing WordPress codebase. For example, Extended_Pictographic is not mentioned in core.

Last edited 8 weeks ago by westonruter (previous) (diff)

#5 @westonruter
8 weeks ago

From some conversations with others, this replacement of ↗ (and presumably also south east, south west, north west arrows) appears to be a recent change in WordPress, not present in 6.8 and happening sometime between September 3 and now.

I believe this is simply because the version of Twemoji was updated in #64184. Because operating systems don't support all of the latest emoji, this is causing all emoji to be replaced with images by Twemoji. Specifically, in [61134] the test for Emoji compatibility changed from the Splatter emoji to the Hairy creature (Sasquatch!) emoji.

Ideally, Twemoji wouldn't update emoji which the OS/browser already support!

This is surely out of scope for this ticket, but since it is highly unlikely that newer emoji will be used frequently to begin with, an enhancement we could use to avoid needlessly running Twemoji would be to check if the page is using any of the emoji from specific versions, and then dynamically change which characters are used in the emoji test for OS/browser support. With the new template enhancement output buffer in 6.9, this would be doable for classic themes, and it should be doable without output buffering in block themes already.

#6 @peterwilsoncc
7 weeks ago

Ideally, Twemoji wouldn't update emoji which the OS/browser already support!

My recollection is that it was decided to replace all emoji to ensure the designs are consistent. For example, so systems using Noto Emoji don't end up with a mixture of colour and black and white designs.


Rather than make changes to the WordPress code base, I think it would be good to open an upstream issue in the Twemoji issue tracker. If it was a design decision to replace the non-emoji arrows glyph then a change to the WordPress code base can be considered; if it was unintentional then it's best to contribute back to the upstream code base.

This ticket was mentioned in PR #10603 on WordPress/wordpress-develop by @Presskopp.


7 weeks ago
#7

  • Keywords has-patch added; needs-patch removed

added more arrow symbol codes to be ignored from being parsed as emoji

Trac ticket: 64318

@wildworks commented on PR #10603:


6 weeks ago
#8

The emoji.js file is parsed as ES5, but uses ES6 syntax such as const and new Set.

I'm not an expert on this, but is it possible to use ES6 syntax in core JS code now?

@westonruter commented on PR #10603:


6 weeks ago
#9

Yes, we're using this now in some files. For example in:

It was only made possible relatively recently since r56247 when jsvalidate was removed, since that tool didn't support ES6+ syntax.

@wildworks commented on PR #10603:


6 weeks ago
#10

I see, in that case, I think we need to add /* eslint-env es6 */ to the file to suppress the error that the code editor gives us.

https://github.com/user-attachments/assets/0c2867e4-c78e-4836-9dbb-4e3a9d2c5005

#11 @peterwilsoncc
5 weeks ago

  • Version changed from 6.9 to 4.2

I'd prefer not to include this in 6.9.1 as the issue was not introduced in the 6.9 release cycle.

As Twemoji is generally quicker at releasing new Unicode versions than operating systems, it becomes apparent each time WordPress upgrades but it's unrelated to 6.9 none-the-less. It's been around since Twemoji was introduced in WP 4.2

#12 @jorbin
7 days ago

  • Milestone changed from 6.9.1 to 7.0

I agree with @peterwilsoncc that this is not appopriate for 6.9.1. As such, I am moving this to the 7.0 milestone

Note: See TracTickets for help on using tickets.