Posting non-latin based languages with ajax + jquery doesn't save to mysql the correct text.
What I have done is this:
- I am getting multiple translated words from Google's translation api.
- The ajax request is showing the correct translations for all languages.
- But when i try and insert this into the db it shows up in php my admin as garbled text
- I added AddDefaultCharset UTF-8 to .htaccess file on the root.
- I tried setting the header in php to utf-8 and this did not work.
- I have tried adding a contentType to ajax setup but this didn't work also.
Any suggestions appreciated.
I am using the following jquery code :
I am able to see the translated text sent to the save_translation.php page
var d = {"english":"<?php echo $w;?>","addwords":translated};
data = jQuery.param(d);
$.ajax({
type:"POST",
data:data,
url:"save_translation.php"
});
Each field is set to utf8_general_ci
UPDATED : responses:
Ajax post
english:thank you addwords:baie dankie|falemnderit|شكرا|дзякуй|благодаря|gràcies|谢谢|谢谢|謝謝|hvala vam|děkuji|tak|dank u|thank you|tänan teid|salamat|kiitos|merci|grazas|Danke|σας ευχαριστώ|תודה|धन्यवाद|köszönöm|þakka þér|terima kasih|go raibh maith agat|grazie|ありがとう|감사합니다|paldies|ačiū|Ви благодарам|terima kasih|nirringrazzjak|takk skal du ha|تشکر از شما|dziękuję|obrigado|mulţumesc|спасибо|хвала|ďakujem|hvala|gracias|asante|tack|salamat|คุณขอบคุณ|teşekkür ederim|спасибі|cảm ơn bạn|ddiolch 'ch|אַ דאַנק
Server Side ouput
english : thank you
baie dankie|falemnderit|شكرا|дзякуй|благодаря|gràcies|谢谢|谢谢|謝謝|hvala vam|děkuji|tak|dank u|thank you|tänan teid|salamat|kiitos|merci|grazas|Danke|σας ευχαριστώ|תודה|धन्यवाद|köszönöm|þakka þér|terima kasih|go raibh maith agat|grazie|ありがとう|감사합니다|paldies|ačiū|Ви благодарам|terima kasih|nirringrazzjak|takk skal du ha|تشکر از شما|dziękuję|obrigado|mulţumesc|спасибо|хвала|ďakujem|hvala|gracias|asante|tack|salamat|คุณขอบคุณ|teşekkür ederim|спасибі|cảm ơn bạn|ddiolch 'ch|אַ דאַנק|
Each field is set to utf8_general_ci
PhpMyAdmin
thank you|baie dankie|falemnderit|شكرا|дзÑкуй|благодарÑ|grà cies|谢谢|谢谢|è¬è¬|hvala vam|dÄ›kuji|tak|dank u|thank you|tänan teid|salamat|kiitos|merci|grazas|Danke|σας ευχαÏιστώ|תודה|धनà¥à¤¯à¤µà¤¾à¤¦|köszönöm|þakka þér|terima kasih|go raibh maith agat|grazie|ã‚ã‚ŠãŒã¨ã†|ê°ì‚¬í•©ë‹ˆë‹¤|paldies|aÄiÅ«|Ви благодарам|terima kasih|nirringrazzjak|takk skal du ha|تشکر از شما|dziÄ™kujÄ™|obrigado|mulÅ£umesc|ÑпаÑибо|хвала|Äakujem|hvala|gracias|asante|tack|salamat|คุณขภบคุณ|teÅŸekkür ederim|ÑпаÑибі|cảm Æ¡n bạn|ddiolch 'ch|×Ö· ד×Ö·× ×§