python googletrans utf-8 端有问题
there is problem for python googletrans utf-8 side
from googletrans import Translator
translator = Translator()
translation = translator.translate("Hello friends", src="en", dest='tr')
print(translation.text)
输出:
Merhaba arkadaÅŸlar
但它应该是“Merhaba arkadaşlar”而不是“Merhaba arkadaÅŸlar”。我正在尝试将 utf-8 应用于输出,但它不起作用。
我刚刚使用 API 到 cmd
直接检查了它,它确实翻译正确。有一个 bug posted on this before (linked from this ), which I believe to be what you might be seeing. Perhaps you may need to update the installed module or try the option to use str.replace.
这是 curl
通过 cmd
请求的结果:
{
"data": {
"translations": [
{
"translatedText": "Merhaba arkadaşlar"
}
]
}
}
from googletrans import Translator
translator = Translator()
translation = translator.translate("Hello friends", src="en", dest='tr')
print(translation.text)
输出:
Merhaba arkadaÅŸlar
但它应该是“Merhaba arkadaşlar”而不是“Merhaba arkadaÅŸlar”。我正在尝试将 utf-8 应用于输出,但它不起作用。
我刚刚使用 API 到 cmd
直接检查了它,它确实翻译正确。有一个 bug posted on this before (linked from this
这是 curl
通过 cmd
请求的结果:
{
"data": {
"translations": [
{
"translatedText": "Merhaba arkadaşlar"
}
]
}
}