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

Add a polyfill for the normalize function to support older browsers #13157

Open
Zodiac1978 opened this Issue Jan 1, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@Zodiac1978
Copy link

Zodiac1978 commented Jan 1, 2019

Describe the bug
Following the advise from here to open an issue: #7105 (comment)

Related: #433 #6958

Pasting NFD text will break the internal search in WP and can break the search on the website (like in Firefox), spellcheck, and the display (showing the character + combining character side by side and not overlaying it, Firefox is failing here for example).

And it can happen all the time that apps output NFD text and not NFC, like the W3C is recommending.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://core.trac.wordpress.org/ticket/30130
  2. Download the PDF
  3. Open it in Preview on Mac
  4. Copy the text
  5. Paste it in the editor, for example in a paragraph
  6. See the broken search in browser and in WP, broken spellcheck, maybe display (Firefox) in all browsers who do not support the normalize feature: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize

(This also affects other areas: Pasting the text in the title would break the transliteratin from "ü" to "ue" in the slug for German sites for example.

Expected behavior
Should work in all browsers. Browsers with no support should use a polyfill.

Screenshots
Broken display in Firefox with NFD text:
tinymce-front-page-screenshot-paste-1

Desktop (please complete the following information):
See link above for problematic browsers with no support:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize

Sometimes people do not have the latest OS and therefore not the latest browser version!

Additional context
This is not a Mac specific problem but because of the filesystem HFS+ which uses NFD it is mostly a Mac problem. But every bad program can output NFD instead of NFC and all web CMS should normalize user input to NFC in this case (as recommended by the W3C).

If you need more information about NFC and how non-NFC is breaking WP, please ask specific question and I am happily try to answer them. Thank you very much!

@swissspidy

This comment has been minimized.

Copy link
Member

swissspidy commented Jan 2, 2019

Looks like https://github.com/walling/unorm could be used, but it hasn‘t been updated in a while.

@Zodiac1978

This comment has been minimized.

Copy link
Author

Zodiac1978 commented Jan 2, 2019

Yes, @swissspidy - this was mentioned before:
tinymce/tinymce#1971 (comment)
https://core.trac.wordpress.org/ticket/30130#comment:28

but it hasn‘t been updated in a while.

Maybe just a stable script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.