1. <legend id='VNJps'><style id='VNJps'><dir id='VNJps'><q id='VNJps'></q></dir></style></legend>

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

          <bdo id='VNJps'></bdo><ul id='VNJps'></ul>
      1. <small id='VNJps'></small><noframes id='VNJps'>

        将 PHP 默认编码设置为 utf-8?

        时间:2023-09-22
      2. <small id='zf8gj'></small><noframes id='zf8gj'>

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

              <tfoot id='zf8gj'></tfoot>

                • 本文介绍了将 PHP 默认编码设置为 utf-8?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在PHP Cookbook"中,他们说 (p.589) 要将输出数据的字符编码正确设置为 utf-8,必须将 default_encoding 配置编辑为 utf-8.

                  In the "PHP Cookbook", they say (p.589) that to properly set the char encoding of outgoing data to utf-8 it is necessary to edit the default_encoding configuration to utf-8.

                  然而,我在php.ini 中找不到这个配置.我应该简单地添加一行表示 default_encoding = "utf-8" 吗?

                  However, I cannot find this configuration in php.ini. Should I simply add a line that would say default_encoding = "utf-8"?

                  我确实有一个 ;default_charset = "iso-8859-1" .正如你所看到的 (;),现在它没有被激活.我应该删除分号并将其设置为 "utf-8" 吗?这会处理默认编码吗?

                  I do have a ;default_charset = "iso-8859-1" . As you can see (;), right now it is not activated. Should I remove the semi-colon and set it to "utf-8"? Does that take care of the default encoding?

                  我还发现了其他我不知道该怎么做的编码指令:

                  I also found other encoding directives that I don't know what to do about:

                  [iconv]
                  ;iconv.input_encoding = ISO-8859-1
                  ;iconv.internal_encoding = ISO-8859-1
                  ;iconv.output_encoding = ISO-8859-1
                  ...
                  ; http://php.net/exif.encode-unicode
                  ;exif.encode_unicode = ISO-8859-15
                  ...
                  ;mssql.charset = "ISO-8859-1"
                  ...
                  ;exif.encode_unicode = ISO-8859-15
                  

                  有什么理由我不应该简单地将它们全部替换为 utf-8?

                  Is there any reason why I shouldn't simply replace them all with utf-8?

                  推荐答案

                  您应该将 default_charset 设置为 UTF-8:

                  You should set your default_charset to UTF-8:

                  default_charset = "utf-8"
                  

                  (如果 PHP Cookbook 要求您更改 default_encoding,则其中可能有错字 — 我从未听说过.)

                  (PHP Cookbook may have a typo in it if they ask you to change the default_encoding — I've never heard of it.)

                  如果您要输出 UTF-8 编码的字符,您还需要确保您的网络服务器设置为输出 UTF-8.在 Apache 中,这可以在 httpd.conf 文件中设置:

                  You'll also want to make sure that your webserver is set to output UTF-8 if you're going to outputting UTF-8 encoded characters. In Apache this can be set by in the httpd.conf file:

                  AddDefaultCharset UTF-8
                  

                  至于修改iconvexifmssql编码设置,你可能不需要设置这些(你的设置有这些无论如何都被注释掉了)但无论如何将它们全部更改为 UTF-8 是个好主意.

                  As for modifying the iconv, exif, and mssql encoding settings, you probably don't need to set these (your settings have these commented out anyhow) but it's a good idea to change them all to UTF-8 anyhow.

                  这篇关于将 PHP 默认编码设置为 utf-8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PHP:将 unicode 代码点转换为 UTF-8 下一篇:如何获取 utf-8 字符串中给定字符的代码点编号

                  相关文章

                  最新文章

                      <legend id='F40sh'><style id='F40sh'><dir id='F40sh'><q id='F40sh'></q></dir></style></legend>
                        <bdo id='F40sh'></bdo><ul id='F40sh'></ul>
                    1. <small id='F40sh'></small><noframes id='F40sh'>

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