等价于perl中的mb_convert_encoding() [英] equivalent for mb_convert_encoding() in perl
问题描述
在解析为数据库之前,我需要从csv文件中删除Windows字符.这些字符是长连字符"或单词倒逗号"
I need to remove windows characters from a csv file before parsing into a database. These are characters like the "long hyphen" or "word inverted commas"
在php中,我可以使用mb_convert_encoding()删除,我该如何在perl中做同样的事情?
In php I can remove with mb_convert_encoding(), How can I do the same in perl ?
我只需要删除Windows字符,而不是utf-8字符
I need to remove only windows characters , not utf-8 characters
推荐答案
编码from_to()函数>似乎非常适合 mb_convert_encoding()
.
The from_to()
function from Encode seems to be a pretty close match for mb_convert_encoding()
.
但这听起来像是您有一个文件,其中某些文件使用 CP1252 进行了编码其中一些在 UTF8 中.这似乎很奇怪,我不确定您如何判断文件的哪一部分具有每种编码方式.
But it sounds like you have a file where some of it is encoded in CP1252 and some of it is in UTF8. That seems strange and I'm not sure how you'd tell which bit of the file has each encoding.
这篇关于等价于perl中的mb_convert_encoding()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!