Stichoza / google-translate-php

🔤 Free Google Translate API PHP Package. Translates totally free of charge.
MIT License
1.82k stars 383 forks source link

Issues with special characters (emojis maybe?) #69

Closed frzsombor closed 8 years ago

frzsombor commented 8 years ago

Looking at my error log, I just found that if a special character (in my error log: 💘 - more info ) was entered in a sentence, something went wrong, and the folloing exception was raised:

'Client error: `POST http://translate.google.com/translate_a/single` resulted in a `403 Forbidden` response: <!DOCTYPE html> <html lang=en>   <meta charset=utf-8>   <meta name=viewport content="initial-scale=1, minimum-scale=1, w (truncated...) ' 
in /path/to/vendor/stichoza/google-translate-php/src/Stichoza/GoogleTranslate/TranslateClient.php:286 
Stack trace: 
#0 /path/to/vendor/stichoza/google-translate-php/src/Stichoza/GoogleTranslate/TranslateClient.php(323): Stichoza\GoogleTranslate\TranslateClient->getResponse('TEST \xF0\x9F\x92\x98') 
#1 /path/to/vendor/stichoza/google-translate-php/src/Stichoza/GoogleTranslate/TranslateClient.php(185): Stichoza\GoogleTranslate\TranslateClient->instanceTranslate('TEST \xF0\x9F\x92\x98') 
#2 /path/to/include/googletranslate.class.php(61): Stichoza\GoogleTranslate\TranslateClient->__call('translate', Array) 
#3 /path/to/include/googletranslate.class.php(61): Stichoza\GoogleTranslate\TranslateClient->translate('TEST \xF0\x9F\x92\x98') 
#4 /path/to/index.php(24): GoogleTranslate->getCode() 
#5 {main} [] []

Of course Google Translate translates it, so for me, it looks like a bug in this project.

frzsombor commented 8 years ago

Sorry, I didn't notice this is a duplicate of #42