dongne1560 2013-07-09 14:09
浏览 46
已采纳

即使utf-8,字符集也会转换为带钻石的问号

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?

EDIT:

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?
  • ¥50 invest生境质量模块
  • ¥15 nhanes加权logistic回归,svyglm函数