utf-8中是否有不同类型的双引号(PHP,str_replace)? [英] Are there different types of double quotes in utf-8 (PHP, str_replace)?

查看:120
本文介绍了utf-8中是否有不同类型的双引号(PHP,str_replace)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP 5.3中,我试图这样替换字符串中的双引号:

In PHP 5.3, am trying to replace double quotes in a string as such:

$bar = str_replace('"','\'',$foo);

但是保存在utf8数据库中的某些引号虽然看起来很正常,但并没有被替换:

But some quotes that are saved in the utf8-Database are not being replaced, although they look perfectly normal:

"Some text"

我需要搜索不同的字符类型吗? 如果是这样,他们是谁?

Are there different character types I have to search for? If so, which are they?

推荐答案

有许多看起来像引号的字符,其中大多数不经常使用.经常使用的是以下三种:

There are many characters that look like quotation marks, most of them are used infrequently. The ones that are used more often are these three:

"   U+0022 QUOTATION MARK
"   U+201C LEFT DOUBLE QUOTATION MARK
"   U+201D RIGHT DOUBLE QUOTATION MARK

一些较罕见的是全幅引号,DITTO标记,DOUBLE PRIME,DOUBLE PRIME引号,等等. Unicode.org易混淆"工具可找到 15个类似于"的字符.

Some rarer ones are FULLWIDTH QUOTATION MARK, the DITTO MARK, the DOUBLE PRIME, the DOUBLE PRIME QUOTATION MARK, and so on. The Unicode.org "confusables" tool finds 15 characters similar to ".

您为什么不在此处复制并粘贴有问题的字符以便我们识别它?或者,您可以使用HEX函数获取字符的十六进制编码,这是识别它的另一种方法.

Why don't you copy and paste the offending character here so we can identify it? Or you could use the HEX function to get the hexadecimal encoding of the character, that's another way of identifying it.

这篇关于utf-8中是否有不同类型的双引号(PHP,str_replace)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆