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

  2. <legend id='BVLs0'><style id='BVLs0'><dir id='BVLs0'><q id='BVLs0'></q></dir></style></legend>
    1. <small id='BVLs0'></small><noframes id='BVLs0'>

    2. PHP:用 UTF-8 字符串中最接近的 7 位 ASCII 等价物替

      时间:2023-10-03
        <legend id='ADRIH'><style id='ADRIH'><dir id='ADRIH'><q id='ADRIH'></q></dir></style></legend>
        <tfoot id='ADRIH'></tfoot>
          <tbody id='ADRIH'></tbody>
          • <bdo id='ADRIH'></bdo><ul id='ADRIH'></ul>
            • <small id='ADRIH'></small><noframes id='ADRIH'>

                <i id='ADRIH'><tr id='ADRIH'><dt id='ADRIH'><q id='ADRIH'><span id='ADRIH'><b id='ADRIH'><form id='ADRIH'><ins id='ADRIH'></ins><ul id='ADRIH'></ul><sub id='ADRIH'></sub></form><legend id='ADRIH'></legend><bdo id='ADRIH'><pre id='ADRIH'><center id='ADRIH'></center></pre></bdo></b><th id='ADRIH'></th></span></q></dt></tr></i><div id='ADRIH'><tfoot id='ADRIH'></tfoot><dl id='ADRIH'><fieldset id='ADRIH'></fieldset></dl></div>
                本文介绍了PHP:用 UTF-8 字符串中最接近的 7 位 ASCII 等价物替换变音符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我想要做的是从字符串中删除所有重音和变音符号,将lärm"变成larm"或andré"变成andre".我试图做的是对字符串进行 utf8_decode,然后在其上使用 strtr,但由于我的源文件保存为 UTF-8 文件,我无法为所有变音符号输入 ISO-8859-15 字符 - 编辑器插入UTF-8 字符.

                What I want to do is to remove all accents and umlauts from a string, turning "lärm" into "larm" or "andré" into "andre". What I tried to do was to utf8_decode the string and then use strtr on it, but since my source file is saved as UTF-8 file, I can't enter the ISO-8859-15 characters for all umlauts - the editor inserts the UTF-8 characters.

                显然,对此的解决方案是拥有一个 ISO-8859-15 文件的包含,但必须有比拥有另一个必需的包含更好的方法吗?

                Obviously a solution for this would be to have an include that's an ISO-8859-15 file, but there must be a better way than to have another required include?

                echo strtr(utf8_decode($input), 
                           'ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ',
                           'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy');
                

                更新:也许我对我尝试做的事情有点不准确:我实际上并不想删除变音符号,而是用它们最接近的一个字符 ASCII"等价物替换它们.

                UPDATE: Maybe I was a bit inaccurate with what I try to do: I do not actually want to remove the umlauts, but to replace them with their closest "one character ASCII" equivalent.

                推荐答案

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

                扩展示例

                这篇关于PHP:用 UTF-8 字符串中最接近的 7 位 ASCII 等价物替换变音符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:PHP:在不知道原始字符集的情况下将任何字符串转 下一篇:file_get_contents() 分解 UTF-8 字符

                相关文章

                最新文章

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

                • <bdo id='suW5W'></bdo><ul id='suW5W'></ul>
                  <tfoot id='suW5W'></tfoot>

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