2013-07-09 14:09
浏览 44


I am using a back end that uses ckeditor. There is nothing changed in the config.js so it is automatically converting french carachters with accents to the html entities.

So if i type é and check the ckeditor source i see é

The database table this field corresponds to is utf8_general_ci

The page charset is: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

so when I load the front end I receive the following:

If I type the é into the ckeditor source, it displays correctly on the page as it is not converting it to the html entity.

now if I turn off the coversion in the ckeditor config.js by: config.entities = false;

Then type the é and check the ckeditor source, it stays as é so I thought this would work,

However when loading the front end I get the error:

Parse error: syntax error, unexpected T_STRING in C:\wamp\www\site\includes\functions\clean_code.php(162) : eval()'d code on line 34

I can paste the clean_code.php code here but I think it is important to keep unchanged for the whole site. So I am kind of stuck. What can I do?


Ok so I tracked it down to a modification which was echoing the description with the following methods:

  echo stripslashes( tep_sanitize_html( html_entity_decode( stripslashes( $product_info[ 'products_description' ] ) ) ) );

The vanilla way to do this is:

<?php echo stripslashes($product_info['products_description']); ?>

So I'm not sure why the developer of this addon decide to use the sanitize html method as well as the decode. but removing them and changing it back to the original way works.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanben4771 2013-07-09 14:21

    These are two questions, so two answers:

    The only logical answer to your problem displaying �, is that somewhere along the line, you are not correctly storing this as UTF-8 and it did get converted to something else.

    The second problem, (fatal error in eval()'d code.) You should post the code that's triggering this error and preferably not even use eval for anything remotely important. Especially not dynamic eval() code, which you appear to be doing.

    点赞 打赏 评论

相关推荐 更多相似问题