GetSimple Support Forum

Full Version: HTML entities don't convert back
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm using polish diacritical characters and site still contain HTML entities. Browsers convert characters on the fly, but Google maybe not.

I solved this problem:

Code:
admin/inc/theme_functions.php

Code:
function get_page_content() {
  global $content;
  exec_action('content-top');
  // echo stripslashes(htmlspecialchars_decode($content, ENT_QUOTES)); <-- do not decode, but I don't know why
  echo stripslashes(html_entity_decode($content, ENT_QUOTES, 'UTF-8'));  // <-- work
  exec_action('content-bottom');
  }

This problem is also in other variables such as title, meta description etc.
SMYS Wrote:I'm using polish diacritical characters and site still contain HTML entities. Browsers convert characters on the fly, but Google maybe not.
It’s completely OK to have HTML entities in your HTML, that’s what they’re for. We had quite the discussion about that here on the forum, you might want to join in there.
SMYS Wrote:
Code:
echo stripslashes(htmlspecialchars_decode($content, ENT_QUOTES)); <-- do not decode, but I don't know why
It doesn’t take care of entities because it takes care of special characters that could mess up coding. This includes quotes and ampersands.
should GS use html_entity_decode instead of htmlspecialchars_decode? Im sure I tried that variation before and decided against it for some reason, but I don't remember why...
Please run this code:

Code:
$content = "&oacute;";
echo htmlspecialchars_decode($content, ENT_QUOTES);
echo "<br />";
echo html_entity_decode($content, ENT_QUOTES, 'UTF-8');

and look into source.

&oacute; == ó