我可以使用iconv将多字节智能引号转换为扩展ASCII智能引号吗? [英] Can I use iconv to convert multi-byte smart quotes to extended ASCII smart quotes?

查看:221
本文介绍了我可以使用iconv将多字节智能引号转换为扩展ASCII智能引号吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些包含多字节智能引用字符的UTF-8内容。我发现这个代码很容易将这些字符转换为ASCII直接引号(ASCII代码34):

I have some UTF-8 content that includes multi-byte smart quote characters. I've found that this code will easily convert those characters to ASCII straight quotes (ASCII code 34):

$content = iconv("UTF-8", "ASCII//TRANSLIT", $content);

$content = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $content);



< 1编码)。

However, I'd rather convert these to extended ASCII smart quotes (ASCII codes 147 and 148 in Latin 1 encoding). Does anyone know how to do this?

推荐答案

您正在寻找 CP-1252 ,其中包含0x91-0x94(145-148)处的卷曲报价。

You're looking for CP-1252 which contains "curly quotes" at 0x91-0x94 (145-148).

$content = iconv("UTF-8", "cp1252//TRANSLIT", $content);

这篇关于我可以使用iconv将多字节智能引号转换为扩展ASCII智能引号吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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