<tfoot id='INX2O'></tfoot>

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

      1. <i id='INX2O'><tr id='INX2O'><dt id='INX2O'><q id='INX2O'><span id='INX2O'><b id='INX2O'><form id='INX2O'><ins id='INX2O'></ins><ul id='INX2O'></ul><sub id='INX2O'></sub></form><legend id='INX2O'></legend><bdo id='INX2O'><pre id='INX2O'><center id='INX2O'></center></pre></bdo></b><th id='INX2O'></th></span></q></dt></tr></i><div id='INX2O'><tfoot id='INX2O'></tfoot><dl id='INX2O'><fieldset id='INX2O'></fieldset></dl></div>
        <legend id='INX2O'><style id='INX2O'><dir id='INX2O'><q id='INX2O'></q></dir></style></legend>

          <bdo id='INX2O'></bdo><ul id='INX2O'></ul>

        fwrite() 和 UTF8

        时间:2023-10-03

        1. <small id='sRQUR'></small><noframes id='sRQUR'>

            <i id='sRQUR'><tr id='sRQUR'><dt id='sRQUR'><q id='sRQUR'><span id='sRQUR'><b id='sRQUR'><form id='sRQUR'><ins id='sRQUR'></ins><ul id='sRQUR'></ul><sub id='sRQUR'></sub></form><legend id='sRQUR'></legend><bdo id='sRQUR'><pre id='sRQUR'><center id='sRQUR'></center></pre></bdo></b><th id='sRQUR'></th></span></q></dt></tr></i><div id='sRQUR'><tfoot id='sRQUR'></tfoot><dl id='sRQUR'><fieldset id='sRQUR'></fieldset></dl></div>
          • <tfoot id='sRQUR'></tfoot>
              <tbody id='sRQUR'></tbody>
                <bdo id='sRQUR'></bdo><ul id='sRQUR'></ul>
                <legend id='sRQUR'><style id='sRQUR'><dir id='sRQUR'><q id='sRQUR'></q></dir></style></legend>
                • 本文介绍了fwrite() 和 UTF8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 php fwrite() 创建一个文件,我知道我的所有数据都在 UTF8 中(我已经对此进行了广泛的测试 - 将数据保存到 db 并在普通网页上输出时一切正常并报告为 utf8.),但我被告知我输出的文件包含非 utf8 数据:( bash (CentOS) 中是否有命令可以检查文件格式?

                  I am creating a file using php fwrite() and I know all my data is in UTF8 ( I have done extensive testing on this - when saving data to db and outputting on normal webpage all work fine and report as utf8.), but I am being told the file I am outputting contains non utf8 data :( Is there a command in bash (CentOS) to check the format of a file?

                  当使用 vim 时,它显示的内容为:

                  When using vim it shows the content as:

                  Donâ~@~Yt 做任何事.... Itâ~@~Ys很棒的网站一切....Weâ~@~Yve 只是启动/

                  Donâ~@~Yt do anything .... Itâ~@~Ys a great site with everything....Weâ~@~Yve only just launched/

                  任何帮助将不胜感激:确认文件是 UTF8 或如何将 utf8 内容写入文件.

                  Any help would be appreciated: Either confirming the file is UTF8 or how to write utf8 content to a file.

                  更新

                  为了阐明我如何知道我有 UTF8 格式的数据,我做了以下工作:

                  To clarify how I know I have data in UTF8 i have done the following:

                  1. DB 设置为 utf8 保存数据时
                  2. 到数据库我先运行这个:

                  1. DB is set to utf8 When saving data
                  2. to database I run this first:

                  $enc = mb_detect_encoding($data);

                  $data = mb_convert_encoding($data, "UTF-8", $enc);

                  就在我运行 fwrite 之前,我已经检查了数据 注意每条数据返回 'IS utf-8'

                  Just before I run fwrite i have checked the data with Note each piece of data returns 'IS utf-8'

                  if (strlen($data)==mb_strlen($data, 'UTF-8')) 打印 '非 UTF-8';否则打印 'IS utf-8';

                  谢谢!

                  推荐答案

                  我唯一要做的就是在 CSV 中添加一个 UTF8 BOM,数据是正确的但文件阅读器(外部应用程序)无法读取没有 BOM 的正确文件

                  The only thing I had to do is add a UTF8 BOM to the CSV, the data was correct but the file reader (external application) couldn't read the file properly without the BOM

                  这篇关于fwrite() 和 UTF8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PHP mysql 字符集 utf8 问题 下一篇:如何让 MySQL 返回 UTF-8?

                  相关文章

                  最新文章

                • <legend id='5gdDm'><style id='5gdDm'><dir id='5gdDm'><q id='5gdDm'></q></dir></style></legend>

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

                    <small id='5gdDm'></small><noframes id='5gdDm'>

                      • <bdo id='5gdDm'></bdo><ul id='5gdDm'></ul>