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

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

      <tfoot id='h9c1j'></tfoot>

        将重音字符转换为它们的纯 ascii 等价物

        时间:2023-10-03
          <bdo id='jWWnb'></bdo><ul id='jWWnb'></ul>

              <tbody id='jWWnb'></tbody>

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

            1. <legend id='jWWnb'><style id='jWWnb'><dir id='jWWnb'><q id='jWWnb'></q></dir></style></legend>
              <i id='jWWnb'><tr id='jWWnb'><dt id='jWWnb'><q id='jWWnb'><span id='jWWnb'><b id='jWWnb'><form id='jWWnb'><ins id='jWWnb'></ins><ul id='jWWnb'></ul><sub id='jWWnb'></sub></form><legend id='jWWnb'></legend><bdo id='jWWnb'><pre id='jWWnb'><center id='jWWnb'></center></pre></bdo></b><th id='jWWnb'></th></span></q></dt></tr></i><div id='jWWnb'><tfoot id='jWWnb'></tfoot><dl id='jWWnb'><fieldset id='jWWnb'></fieldset></dl></div>
              1. <tfoot id='jWWnb'></tfoot>
                  本文介绍了将重音字符转换为它们的纯 ascii 等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我必须在我的 php 上将法语字符转换为英语.我使用了以下代码:

                  I have to convert french characters into english on my php. I've used the following code:

                  iconv("utf-8", "ascii//TRANSLIT", $string);
                  

                  但是 ËËË 的结果是 "E"E"E.

                  我不需要那个双引号和其他额外的字符 - 我想显示像 EEE 这样的输出.有没有其他方法可以将法语转换为英语?你能帮我做这个吗?

                  I don't need that double quote and other extra characters - I want to show an output like EEE. Is there any other method to convert french to english? Can you help me to do this?

                  推荐答案

                  PHP手动 iconv 介绍有一个警告:

                  请注意,某些系统上的 iconv 功能可能无法像您一样工作预计.在这种情况下,最好安装 GNU libiconv图书馆.最终很可能会得到更一致的结果.

                  Note that the iconv function on some systems may not work as you expect. In such case, it'd be a good idea to install the GNU libiconv library. It will most likely end up with more consistent results.

                  但如果重音字符是唯一的问题,那么您可以使用脏 strtr(部分来自 strtr 评论):

                  But if accented characters are the only issue then you could use a dirty strtr (partially from strtr comments):

                  $string = 'Ë À Ì Â Í Ã Î Ä Ï Ç Ò È Ó É Ô Ê Õ Ö ê Ù ë Ú î Û ï Ü ô Ý õ â û ã ÿ ç';
                  
                  $normalizeChars = array(
                      'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A',
                      'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I',
                      'Ï'=>'I', 'Ñ'=>'N', 'Ń'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U',
                      'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss','à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a',
                      'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i',
                      'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ń'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u',
                      'ú'=>'u', 'û'=>'u', 'ü'=>'u', 'ý'=>'y', 'ý'=>'y', 'þ'=>'b', 'ÿ'=>'y', 'ƒ'=>'f',
                      'ă'=>'a', 'î'=>'i', 'â'=>'a', 'ș'=>'s', 'ț'=>'t', 'Ă'=>'A', 'Î'=>'I', 'Â'=>'A', 'Ș'=>'S', 'Ț'=>'T',
                  );
                  
                  //Output: E A I A I A I A I C O E O E O E O O e U e U i U i U o Y o a u a y c
                  echo strtr($string, $normalizeChars);
                  

                  这篇关于将重音字符转换为它们的纯 ascii 等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在MYSQL中将所有表和字段更改为utf-8-bin排序规则的 下一篇:PHP Curl UTF-8 字符集

                  相关文章

                  最新文章

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

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

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