{"id":4666,"date":"2024-12-06T10:17:12","date_gmt":"2024-12-06T15:17:12","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=4666"},"modified":"2024-12-06T13:00:43","modified_gmt":"2024-12-06T18:00:43","slug":"cant-seem-to-remove-the-formatting-from-a-string-of-text","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/cant-seem-to-remove-the-formatting-from-a-string-of-text\/","title":{"rendered":"Can&#8217;t seem to remove the formatting from a string of text?"},"content":{"rendered":"\n<p>I had a fella email me a line of text almost just like this:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\ud835\udc02\ud835\udc1a\ud835\udc25\ud835\udc25\ud835\udc1e \ud835\udc01\ud835\udc25\ud835\udc1a\ud835\udc27\ud835\udc1c\ud835\udc28\ud835\udc2c, \ud835\udc02\ud835\udc28\ud835\udc2c\ud835\udc2d\ud835\udc1a \ud835\udc11\ud835\udc22\ud835\udc1c\ud835\udc1a<\/p>\n<\/blockquote>\n\n\n\n<p>He said he could <em>not<\/em> remove that formatting no matter what he did. It looks kinda bold, doesn&#8217;t it? And set into a serif font. You&#8217;d think you could select it in the text editor you&#8217;re in and remove that formatting. He said he tried copy\/pasting it into places where no text formatting is even allowed, like in VS Code or the URL bar of a browser. Voodoo, he said.<\/p>\n\n\n\n<p>Here&#8217;s the thing: that text <em>isn&#8217;t<\/em> formatted. <\/p>\n\n\n\n<p>That first &#8220;C&#8221; you see above isn&#8217;t a regular uppercase character C, our typical friend <code>U+0043 : LATIN CAPITAL LETTER C<\/code>, <a href=\"https:\/\/www.babelstone.co.uk\/Unicode\/whatisit.html\">it&#8217;s &#8220;\ud835\udc02&#8221;<\/a>, that is, <code>U+1D402 : MATHEMATICAL BOLD CAPITAL C<\/code>. It&#8217;s literally a different character in Unicode. There are&#8230; a lot of Unicode characters:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>As of&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Unicode\">Unicode<\/a>&nbsp;version 16.0, there are 155,063&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Character_(computing)\">characters<\/a>&nbsp;with&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Code_point\">code points<\/a>, covering 168 modern and historical&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Script_(Unicode)\">scripts<\/a>, as well as multiple symbol sets.<\/p>\n<cite><a href=\"https:\/\/en.wikipedia.org\/wiki\/List_of_Unicode_characters\">List of Unicode characters<\/a> \u2014 Wikipedia<\/cite><\/blockquote>\n\n\n\n<p>It could be written like \ud835\udd6e\ud835\udd86\ud835\udd91\ud835\udd91\ud835\udd8a \ud835\udd6d\ud835\udd91\ud835\udd86\ud835\udd93\ud835\udd88\ud835\udd94\ud835\udd98, \ud835\udd6e\ud835\udd94\ud835\udd98\ud835\udd99\ud835\udd86 \ud835\udd7d\ud835\udd8e\ud835\udd88\ud835\udd86 instead, or \ud835\uddd6\ud835\uddee\ud835\uddf9\ud835\uddf9\ud835\uddf2 \ud835\uddd5\ud835\uddf9\ud835\uddee\ud835\uddfb\ud835\uddf0\ud835\uddfc\ud835\ude00, \ud835\uddd6\ud835\uddfc\ud835\ude00\ud835\ude01\ud835\uddee \ud835\udde5\ud835\uddf6\ud835\uddf0\ud835\uddee. <\/p>\n\n\n\n<p>Should you do this to get super sweet effects in places you otherwise couldn&#8217;t? Probably not. The accessibility is rough. Listen to the audio output <a href=\"https:\/\/blog.nytsoi.net\/2019\/12\/12\/alt-text-for-text\">in this blog post<\/a>. <s>If you&#8217;re going to do it on the web where you have HTML control, do something like:<\/s> <\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-comment\">&lt;!-- Don't do this! Leaving for posterity. --&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">span<\/span> <span class=\"hljs-attr\">aria-label<\/span>=<span class=\"hljs-string\">\"Calle Blancos, Costa Rica\"<\/span>&gt;<\/span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">span<\/span> <span class=\"hljs-attr\">aria-hidden<\/span>=<span class=\"hljs-string\">\"true\"<\/span>&gt;<\/span>\ud835\udd6e\ud835\udd86\ud835\udd91\ud835\udd91\ud835\udd8a \ud835\udd6d\ud835\udd91\ud835\udd86\ud835\udd93\ud835\udd88\ud835\udd94\ud835\udd98, \ud835\udd6e\ud835\udd94\ud835\udd98\ud835\udd99\ud835\udd86 \ud835\udd7d\ud835\udd8e\ud835\udd88\ud835\udd86<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">span<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">span<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>UPDATE: <a href=\"https:\/\/frontendmasters.com\/blog\/cant-seem-to-remove-the-formatting-from-a-string-of-text\/#comment-16908\">See Ben&#8217;s comment<\/a> on why not to do the above. Instead, make a <a href=\"https:\/\/www.a11yproject.com\/posts\/how-to-hide-content\/\">visually hidden version<\/a> that a screen reader would still see, and an ARIA hidden one that will be seen visually. (Noting potential concerns about copy\/paste that started this whole article.)<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">span<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"visually-hidden\"<\/span>&gt;<\/span>Calle Blancos, Costa Rica<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">span<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">span<\/span> <span class=\"hljs-attr\">aria-hidden<\/span>=<span class=\"hljs-string\">\"true\"<\/span>&gt;<\/span>\ud835\udd6e\ud835\udd86\ud835\udd91\ud835\udd91\ud835\udd8a \ud835\udd6d\ud835\udd91\ud835\udd86\ud835\udd93\ud835\udd88\ud835\udd94\ud835\udd98, \ud835\udd6e\ud835\udd94\ud835\udd98\ud835\udd99\ud835\udd86 \ud835\udd7d\ud835\udd8e\ud835\udd88\ud835\udd86<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">span<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>","protected":false},"excerpt":{"rendered":"<p>\ud835\udc0f\ud835\udc28\ud835\udc2d\ud835\udc1a\ud835\udc2d\ud835\udc28 is not just Potato formatted.<\/p>\n","protected":false},"author":1,"featured_media":4734,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[31,39,268],"class_list":["post-4666","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-post","tag-html","tag-typography","tag-unicode"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/12\/unicode.png?fit=1118%2C722&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/4666","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=4666"}],"version-history":[{"count":9,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/4666\/revisions"}],"predecessor-version":[{"id":4741,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/4666\/revisions\/4741"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/4734"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=4666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=4666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=4666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}