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.

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

报告相同问题?

悬赏问题

  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路