dousi1970 2011-08-18 03:49
浏览 16
已采纳

错误:“无法发送与编码相关的会话缓存限制器”

I'm started having problems with the encoding, it seems that somehow Notepad++ changed the encoding or something. Anyway all files where encoded in UTF-8, but I checked and some changed to UTF-8 without BOM. Changing one to UTF-8 fixed the special characters issue.

"Tageá" changed to "Tageá" but I started getting an error:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/02/6945202/html/usuario/index.php:1) in /home/content/02/6945202/html/usuario/index.php on line 1

This is line 1:

<? session_start(); ?>

I don't understand why I'm having this issue, since using ANSI or UTF-8 without BOM the page shows with no errors.

What can be the problem? Thanks

  • 写回答

3条回答 默认 最新

  • douan1893 2011-08-18 03:58
    关注

    http://blog.onitindustries.com/php/errors/php-session_start-on-first-line-still-getting-error/

    ok try using this function to convert strings, save file as utf-8 without bom for this.

    <?php
    session_start();
    function charset_decode_utf_8 ($string) {
      /* Only do the slow convert if there are 8-bit characters */
        /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */
        if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string))
            return $string;
    
        // decode three byte unicode characters
        $string = preg_replace("/([\340-\357])([\200-\277])([\200-\277])/e",     
        "'&#'.((ord('\\1')-224)*4096 + (ord('\\2')-128)*64 + (ord('\\3')-128)).';'",    
        $string);
    
        // decode two byte unicode characters
        $string = preg_replace("/([\300-\337])([\200-\277])/e", 
        "'&#'.((ord('\\1')-192)*64+(ord('\\2')-128)).';'", 
        $string);
    
        return $string;
    }
    echo charset_decode_utf_8('Tageá');
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度