久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='YHTNU'><style id='YHTNU'><dir id='YHTNU'><q id='YHTNU'></q></dir></style></legend>

      • <bdo id='YHTNU'></bdo><ul id='YHTNU'></ul>
    1. <i id='YHTNU'><tr id='YHTNU'><dt id='YHTNU'><q id='YHTNU'><span id='YHTNU'><b id='YHTNU'><form id='YHTNU'><ins id='YHTNU'></ins><ul id='YHTNU'></ul><sub id='YHTNU'></sub></form><legend id='YHTNU'></legend><bdo id='YHTNU'><pre id='YHTNU'><center id='YHTNU'></center></pre></bdo></b><th id='YHTNU'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YHTNU'><tfoot id='YHTNU'></tfoot><dl id='YHTNU'><fieldset id='YHTNU'></fieldset></dl></div>
    2. <small id='YHTNU'></small><noframes id='YHTNU'>

    3. <tfoot id='YHTNU'></tfoot>

      1. 使用 fgetcsv 讀取 CSV 文件時出現 UTF-8 問題

        UTF-8 problems while reading CSV file with fgetcsv(使用 fgetcsv 讀取 CSV 文件時出現 UTF-8 問題)
          <tbody id='whVBV'></tbody>
          <bdo id='whVBV'></bdo><ul id='whVBV'></ul>
              1. <legend id='whVBV'><style id='whVBV'><dir id='whVBV'><q id='whVBV'></q></dir></style></legend>
                1. <tfoot id='whVBV'></tfoot>

                  <i id='whVBV'><tr id='whVBV'><dt id='whVBV'><q id='whVBV'><span id='whVBV'><b id='whVBV'><form id='whVBV'><ins id='whVBV'></ins><ul id='whVBV'></ul><sub id='whVBV'></sub></form><legend id='whVBV'></legend><bdo id='whVBV'><pre id='whVBV'><center id='whVBV'></center></pre></bdo></b><th id='whVBV'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='whVBV'><tfoot id='whVBV'></tfoot><dl id='whVBV'><fieldset id='whVBV'></fieldset></dl></div>

                  <small id='whVBV'></small><noframes id='whVBV'>

                  本文介紹了使用 fgetcsv 讀取 CSV 文件時出現 UTF-8 問題的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我嘗試讀取 CSV 并回顯內容.但內容顯示字符錯誤.

                  I try to read a CSV and echo the content. But the content displays the characters wrong.

                  M?x Müsterm?nn -> M?¤x M??sterm?¤nn

                  M?x Müsterm?nn -> M?¤x M??sterm?¤nn

                  CSV 文件的編碼是沒有 BOM 的 UTF-8(用 Notepad++ 檢查).

                  Encoding of the CSV file is UTF-8 without BOM (checked with Notepad++).

                  這是 CSV 文件的內容:

                  This is the content of the CSV file:

                  "M?x";"Müsterm?nn"

                  我的 PHP 腳本

                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  <html xmlns="http://www.w3.org/1999/xhtml">
                  <head>
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                  </head>
                  <body>
                  <?php
                  $handle = fopen ("specialchars.csv","r");
                  echo '<table border="1"><tr><td>First name</td><td>Last name</td></tr><tr>';
                  while ($data = fgetcsv ($handle, 1000, ";")) {
                          $num = count ($data);
                          for ($c=0; $c < $num; $c++) {
                              // output data
                              echo "<td>$data[$c]</td>";
                          }
                          echo "</tr><tr>";
                  }
                  ?>
                  </body>
                  </html>
                  

                  我嘗試使用 setlocale(LC_ALL, 'de_DE.utf8'); 作為建議 此處 沒有成功.內容還是顯示錯誤.

                  I tried to use setlocale(LC_ALL, 'de_DE.utf8'); as suggested here without success. The content is still wrong displayed.

                  我缺少什么?

                  一個 echo mb_detect_encoding($data[$c],'UTF-8'); 給我 UTF-8 UTF-8.

                  An echo mb_detect_encoding($data[$c],'UTF-8'); gives me UTF-8 UTF-8.

                  echo file_get_contents("specialchars.csv"); 給我 "M?¤x";"M??sterm?¤nn".

                  print_r(str_getcsv(reset(explode("
                  ", file_get_contents("specialchars.csv"))), ';'))
                  

                  給我

                  Array ( [0] => M?¤x [1] => M??sterm?¤nn )

                  什么意思?

                  推薦答案

                  現在我開始工作了(刪除 header 命令后).我認為問題在于 php 文件的編碼是 ISO-8859-1.我將它設置為沒有 BOM 的 UTF-8.我以為我已經這樣做了,但也許我做了一個額外的撤消.

                  Now I got it working (after removing the header command). I think the problem was that the encoding of the php file was in ISO-8859-1. I set it to UTF-8 without BOM. I thought I already have done that, but perhaps I made an additional undo.

                  此外,我為數據庫使用了SET NAMES 'utf8'.現在在數據庫中也是正確的.

                  Furthermore, I used SET NAMES 'utf8' for the database. Now it is also correct in the database.

                  這篇關于使用 fgetcsv 讀取 CSV 文件時出現 UTF-8 問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                    <tbody id='iCDm9'></tbody>
                  • <legend id='iCDm9'><style id='iCDm9'><dir id='iCDm9'><q id='iCDm9'></q></dir></style></legend>
                    • <tfoot id='iCDm9'></tfoot>

                      <small id='iCDm9'></small><noframes id='iCDm9'>

                          <bdo id='iCDm9'></bdo><ul id='iCDm9'></ul>
                          <i id='iCDm9'><tr id='iCDm9'><dt id='iCDm9'><q id='iCDm9'><span id='iCDm9'><b id='iCDm9'><form id='iCDm9'><ins id='iCDm9'></ins><ul id='iCDm9'></ul><sub id='iCDm9'></sub></form><legend id='iCDm9'></legend><bdo id='iCDm9'><pre id='iCDm9'><center id='iCDm9'></center></pre></bdo></b><th id='iCDm9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='iCDm9'><tfoot id='iCDm9'></tfoot><dl id='iCDm9'><fieldset id='iCDm9'></fieldset></dl></div>

                            主站蜘蛛池模板: 国产农村妇女毛片精品久久麻豆 | 国产精品久久久精品 | 奇米久久| 国产一区在线免费 | 国产精品激情小视频 | 久草视频在线播放 | 国产精品国产精品国产专区不蜜 | 情侣酒店偷拍一区二区在线播放 | 黄在线免费观看 | 性色视频 | 水蜜桃亚洲一二三四在线 | 国产在线中文字幕 | 亚洲精品中文在线观看 | 亚洲男人网 | 国产亚洲精品区 | 欧州一区二区三区 | 久久国产综合 | 天天干人人 | 日韩精品成人网 | a级片在线观看 | 国产美女精品 | 日韩在线一区二区三区 | 日韩在线欧美 | 老牛嫩草一区二区三区av | 欧美一区二区三区免费电影 | 国产精品欧美精品 | 精品一区电影 | 亚洲国产精品久久久久秋霞不卡 | 99福利在线观看 | 五月综合激情网 | 一区二区三区观看视频 | 日本午夜免费福利视频 | 国产精品日韩欧美一区二区三区 | 中文字幕国 | 色婷婷综合久久久中字幕精品久久 | 天堂影院av| 国产精品一区在线播放 | 在线观看中文字幕视频 | 国产午夜精品一区二区三区四区 | 久久久日韩精品一区二区三区 | 成人免费视频网 |