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

    <small id='12Mf2'></small><noframes id='12Mf2'>

      <bdo id='12Mf2'></bdo><ul id='12Mf2'></ul>
      <legend id='12Mf2'><style id='12Mf2'><dir id='12Mf2'><q id='12Mf2'></q></dir></style></legend>
    1. <tfoot id='12Mf2'></tfoot>

      1. 如何修复双重编码的 UTF8 字符(在 utf-8 表中)

        时间:2023-06-01

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

          <tfoot id='aM2VA'></tfoot>

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

          • <i id='aM2VA'><tr id='aM2VA'><dt id='aM2VA'><q id='aM2VA'><span id='aM2VA'><b id='aM2VA'><form id='aM2VA'><ins id='aM2VA'></ins><ul id='aM2VA'></ul><sub id='aM2VA'></sub></form><legend id='aM2VA'></legend><bdo id='aM2VA'><pre id='aM2VA'><center id='aM2VA'></center></pre></bdo></b><th id='aM2VA'></th></span></q></dt></tr></i><div id='aM2VA'><tfoot id='aM2VA'></tfoot><dl id='aM2VA'><fieldset id='aM2VA'></fieldset></dl></div>
              <tbody id='aM2VA'></tbody>
                • <bdo id='aM2VA'></bdo><ul id='aM2VA'></ul>
                  本文介绍了如何修复双重编码的 UTF8 字符(在 utf-8 表中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  之前的 LOAD DATA INFILE 是在假设 CSV 文件是 latin1 编码的情况下运行的.在此导入过程中,多字节字符被解释为两个单个字符,然后(再次)使用 utf-8 进行编码.

                  A previous LOAD DATA INFILE was run under the assumption that the CSV file is latin1-encoded. During this import the multibyte characters were interpreted as two single character and then encoded using utf-8 (again).

                  这种双重编码产生了像±而不是这样的异常.

                  This double-encoding created anomalies like ± instead of .

                  如何更正这些字符串?

                  推荐答案

                  下面的MySQL函数会在双重编码后返回正确的utf8字符串:

                  The following MySQL function will return the correct utf8 string after double-encoding:

                  CONVERT(CAST(CONVERT(field USING latin1) AS BINARY) USING utf8)
                  

                  它可以与 UPDATE 语句一起使用以更正字段:

                  It can be used with an UPDATE statement to correct the fields:

                  UPDATE tablename SET
                      field = CONVERT(CAST(CONVERT(field USING latin1) AS BINARY) USING utf8);
                  

                  这篇关于如何修复双重编码的 UTF8 字符(在 utf-8 表中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:MAMP 中包含的 MySQL 是否不包含配置文件? 下一篇:错误:表 xxx 的表空间存在.请在 IMPORT 之前丢弃表空间

                  相关文章

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

                  2. <tfoot id='SZA98'></tfoot>

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

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

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