• Resolved Gukis

    (@gukis)


    Noticed a strange thing. If you view a page in w3 validator or in a “view souce” mode of a browser (Chrome/Edge) the hyphens would turn into hexadecimal symbol –

    Checked other websites built on different CMS, the hyphen is present.

    WP + Seo Framework – view-source:https://pokatushkin.ru/services/prokat-samokatov/
    Drupal – view-source:https://www.tran-express.ru/
    1c Bitrix – view-source:https://lenwood.ru/

    All 3 pages have the word with a hyphen “Санкт-Петербург”, though only WP with the SF plugin feature – instead of just ‘-‘

    Can I do something about it? Should I?

    • This topic was modified 1 year ago by Gukis.
Viewing 1 replies (of 1 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    This is intentional behavior and there’s nothing you need to do. Search engines and all popular social platforms can decode special HTML characters from titles and descriptions; after all, HTML elements may contain HTML entities.

    Here’s why we do this: TSF parses titles and descriptions through WordPress’s texturization (wptexturize()), which converts hyphens (charcode 45) to en-dashes (charcode 8211). Funnily, its documentation page fails to show a hyphen correctly but shows an en-dash instead.

    In any case, because the hyphen is often used as a title separator, we want to maintain the unaltered hyphen. So, to prevent wptexturize() from converting the hyphen to an en-dash, we convert the hyphen to an HTML formatted hyphen: -.

    Still, some users wish to show an em-dash (using two hyphens: -- = ), or endash as intended. So, we determine when we insert the - using advanced regex.

    I hope this makes sense. Cheers!

    • This reply was modified 1 year ago by Sybre Waaijer. Reason: formatting
Viewing 1 replies (of 1 total)
  • The topic ‘Hyphen is turned into HTML hexadecimal code in “view source” mode’ is closed to new replies.