My English is not good, sorry
There is a problem with the number of Chinese characters
php version of api interface
UTF-8 string “我是中国人”
rawurlencode(“我是中国人”) = %E6%88%91%E6%98%AF%E4%B8%AD%E5%9B%BD%E4%BA%BA
strlen(‘我是中国人’) = 15 characters in length
strlen(’%E6%88%91%E6%98%AF%E4%B8%AD%E5%9B%BD%E4%BA%BA’) = 45 characters in length
Originally, the Chinese characters I submitted were less than 5000 characters in length
The character length after rawurlencode exceeds 5000
Cause the api interface to return an error with characters exceeding 5000
array(2) {
[“status”]=>
int(412)
[“Error”]=>
string(77) “Text with More than 5000 characters or less than one Character is not allowed”
}
Присоединяйтесь к обсуждению – добавьте комментарий ниже:
Hi,
Have you tried using the POST method?
The calculation of the length of the text should be done after the text is decoded.
I’ve tried to translate the text in the example above with GET method and I get the length of the text is 5 in the response.
{ "status": 200, "from": "auto", "to": "en", "original_text": "我是中国人", "translated_text": { "en": "I am Chinese" }, "translated_characters": 5 }
To make the investigation easier, could you send us the full text you want to translate that produces the error?
Thanks