Comments on: Can’t seem to remove the formatting from a string of text? https://frontendmasters.com/blog/cant-seem-to-remove-the-formatting-from-a-string-of-text/ Helping Your Journey to Senior Developer Wed, 18 Dec 2024 23:32:43 +0000 hourly 1 https://wordpress.org/?v=6.8.3 By: James Moberg https://frontendmasters.com/blog/cant-seem-to-remove-the-formatting-from-a-string-of-text/#comment-17695 Wed, 18 Dec 2024 23:32:43 +0000 https://frontendmasters.com/blog/?p=4666#comment-17695 I focus more on backend (versus frontend) using ColdFusion. CF runs on top of Java and I use the java.text.Normalizer class and JUnidecode library to normalize Unicode strings and reduce them to ASCII 7. (I started doing this because comment form spammers started using Unicode to bypass spam filters.)
https://github.com/gcardone/junidecode

Related to this, I added this function to a REST API and wrote a Windows AutoHotKey shortcut to take my clipboard, pass the contents to the API and return ASCII7 content free of any Unicode formatting.

]]>
By: Chris Coyier https://frontendmasters.com/blog/cant-seem-to-remove-the-formatting-from-a-string-of-text/#comment-16911 Fri, 06 Dec 2024 17:57:43 +0000 https://frontendmasters.com/blog/?p=4666#comment-16911 In reply to Ben Myers.

Oh shucks, all I looked at was VoiceOver which did indeed to the “right” thing”

https://share.cleanshot.com/WdZlpRng

I’ll update the post with the recommended technique.

]]>
By: Ben Myers https://frontendmasters.com/blog/cant-seem-to-remove-the-formatting-from-a-string-of-text/#comment-16908 Fri, 06 Dec 2024 16:00:53 +0000 https://frontendmasters.com/blog/?p=4666#comment-16908 Howdy! Great callout on not using alternate Unicode characters in place of the true characters for these letters. Unfortunately, placing an aria-label on a roleless span (or any generic element) is not a valid use of aria-label, and so you won’t get the results this article would expect in most screenreader/browser combinations. VoiceOver for macOS will do this substitution, which is what leads to developers’ expectations in this case, but this is nonstandard behavior that shouldn’t be relied upon.

In this case, the safest thing to do would probably be to combine a .visually-hidden/.sr-only span with the safe characters, with an aria-hidden span of the alternate Unicode characters.

]]>