在 Python 中检测字符集并转换为 utf-8? [英] Detect charset and convert to utf-8 in Python?

查看:21
本文介绍了在 Python 中检测字符集并转换为 utf-8?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何通用的方法来检测字符串字符集?我使用 IPTC 标签并且没有已知的编码.我需要检测它,然后将它们更改为 utf-8.

Is there any universal method to detect string charset? I user IPTC tags and have no known encoding. I need to detect it and then change them to utf-8.

有人可以帮忙吗?

推荐答案

您想使用 chardet,编码检测器

You want to use chardet, an encoding detector

这篇关于在 Python 中检测字符集并转换为 utf-8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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