Can I use iconv to convert multi-byte smart quotes to extended ASCII smart quotes?

大兔子大兔子 提交于 2019-12-29 06:56:46

问题


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);

OR

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

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?


回答1:


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

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


来源:https://stackoverflow.com/questions/6087309/can-i-use-iconv-to-convert-multi-byte-smart-quotes-to-extended-ascii-smart-quote

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!