如何在php中修剪引号并删除单词中的特殊字符
我们如何修剪引号(单引号和双引号)。在某些单词中,有一些像 � 这样的字符我想删除。如何在 php 中做到这一点?示例单词 我想将
- poup�e 重新格式化为 poupe 或者什么 � 应该是
- “三到三个
- 单词”到单词
how do we trim quotes(single and double). And there are some character like � in some words which i want to remove. How to do it in php. example words i want to reformat
- poup�e to poupe or what that � should have been
- “three to three
- words" to words
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
poup�e 应该是 poupée。按照建议,修复您的编码而不是破坏法语单词:-)
poup�e should be poupée. As suggested, fix your encoding instead of destroying french words :-)
您可以删除引号,
在我看来,出现奇怪的字符是因为您遇到了编码问题。为了解决这个问题,我们需要知道你的程序、数据库和html使用哪种编码。我建议到处使用UTF-8,这基本上可以解决你的编码问题。
You can remove the quotes with
Seems to me that the strange characters appear because you have an encoding issue. For solving this, we need to know what kind of encoding do you use in your program, database, and html. I suggest using UTF-8 everywhere, which will basically solve your encoding problems.
我猜你可以用 preg_replace 做到这一点:
http://php.net/manual/en /function.preg-replace.php
这是一个示例:
http://www.devdaily.com/php/php-string-strip-characters-whitespace-numbers
Guess you can do it with preg_replace:
http://php.net/manual/en/function.preg-replace.php
and here's an example:
http://www.devdaily.com/php/php-string-strip-characters-whitespace-numbers