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

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

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

      <tfoot id='fzeFO'></tfoot>

        如何在字符串中转换 Word 智能引号和破折号?

        时间:2023-09-22
            • <bdo id='eoaHU'></bdo><ul id='eoaHU'></ul>
            • <i id='eoaHU'><tr id='eoaHU'><dt id='eoaHU'><q id='eoaHU'><span id='eoaHU'><b id='eoaHU'><form id='eoaHU'><ins id='eoaHU'></ins><ul id='eoaHU'></ul><sub id='eoaHU'></sub></form><legend id='eoaHU'></legend><bdo id='eoaHU'><pre id='eoaHU'><center id='eoaHU'></center></pre></bdo></b><th id='eoaHU'></th></span></q></dt></tr></i><div id='eoaHU'><tfoot id='eoaHU'></tfoot><dl id='eoaHU'><fieldset id='eoaHU'></fieldset></dl></div>
            • <tfoot id='eoaHU'></tfoot>

                <legend id='eoaHU'><style id='eoaHU'><dir id='eoaHU'><q id='eoaHU'></q></dir></style></legend>

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

                  <tbody id='eoaHU'></tbody>
                1. 本文介绍了如何在字符串中转换 Word 智能引号和破折号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个带有 textarea 的表单.用户输入存储在数据库中的文本块.

                  有时,用户会粘贴 Word 中包含智能引号或短划线的文本.这些字符在数据库中显示为:–、–、–、–

                  我应该在输入字符串上调用什么函数来将智能引号转换为常规引号并将短划线转换为常规短划线?

                  我在 PHP 工作.

                  更新:感谢您到目前为止的所有精彩回复.Joel 网站上关于编码的页面非常有用:http://www.joelonsoftware.com/articles/Unicode.html

                  关于我的环境的一些说明:

                  MySQL 数据库使用 UTF-8 编码.同样,显示内容的 HTML 页面通过显式设置元内容类型使用 UTF-8(更新:).

                  在这些页面上,智能引号和短划线显示为带问号的菱形.

                  解决方案:

                  再次感谢您的回复.解决方案是双重的:

                  1. 确保数据库和 HTML文件被明确设置为使用UTF-8 编码.
                  2. 使用 htmlspecialchars() 而不是htmlentities().

                  解决方案

                  这听起来像是 Unicode 问题.Joel Spolsky 在这个主题上有一个很好的起点:http://www.joelonsoftware.com/articles/Unicode.html

                  I have a form with a textarea. Users enter a block of text which is stored in a database.

                  Occasionally a user will paste text from Word containing smart quotes or emdashes. Those characters appear in the database as: â€", ’, “ ,â€

                  What function should I call on the input string to convert smart quotes to regular quotes and emdashes to regular dashes?

                  I am working in PHP.

                  Update: Thanks for all of the great responses so far. The page on Joel's site about encodings is very informative: http://www.joelonsoftware.com/articles/Unicode.html

                  Some notes on my environment:

                  The MySQL database is using UTF-8 encoding. Likewise, the HTML pages that display the content are using UTF-8 (Update:) by explicitly setting the meta content-type.

                  On those pages the smart quotes and emdashes appear as a diamond with question mark.

                  Solution:

                  Thanks again for the responses. The solution was twofold:

                  1. Make sure the database and HTML files were explicitly set to use UTF-8 encoding.
                  2. Use htmlspecialchars() instead of htmlentities().

                  解决方案

                  This sounds like a Unicode issue. Joel Spolsky has a good jumping off point on the topic: http://www.joelonsoftware.com/articles/Unicode.html

                  这篇关于如何在字符串中转换 Word 智能引号和破折号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 PHP 5.2 中修剪 unicode 空格 下一篇:什么是标准化的 UTF-8?

                  相关文章

                  最新文章

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

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

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