Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HTML entities don't convert back
#1
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.
Reply
#2
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.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#3
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...
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#4
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; == ó
Reply




Users browsing this thread: 1 Guest(s)