duanjing2013 2011-05-31 23:12
浏览 43
已采纳

回声数组ISO-8859-1值正确

I'm having troubles while printing the array values, they are originally encoded with ISO-8859-1 and when echoed they appear with "?". That's so annoying!

I have the charset defined to ISO-8859-15

$lang = array();

$lang['HOMEPAGE'] = 'âéíó';

echo $lang['HOMEPAGE'];

result: ????

Any hints?

It used to work, using the utf8_decode(); but doesn't seem to solve my problem.

EDIT:

I well, i defined the charset for ISO-8859-15, but i was including the file with the "áúóá" characters, before the html header because of cookie interaction, tried to use ob_start to use cookies on the body but the errors remained, defined charset with header() function and worked well, other solution is:

echo iconv('ISO-8859-1', 'UTF-8', $lang['PARAGRAFO1']);
  • 写回答

2条回答 默认 最新

  • dsaob80228 2011-05-31 23:16
    关注

    There are two encodings at work here:

    1. The encoding of your text, in this case the source code.

    2. The encoding of the webpage. Make sure it's set to ISO-8859-1 as well. Put this meta tag in the header of your HTML file to enforce an encoding:

      <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
      
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题