Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 753989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:57:39+00:00 2026-05-14T14:57:39+00:00

Posting non-latin based languages with ajax + jquery doesn’t save to mysql the correct

  • 0

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.

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|×Ö· ד×Ö·× ×§

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:57:39+00:00Added an answer on May 14, 2026 at 2:57 pm

    Probably it will be enough to use JavaScript function encodeURIComponent.

    If you don’t add parameters manual to the URL like myUrl + '?param1=' + param1 + '&param2' + param2, but use construction myUrl + '?' + jQuery.param({param1:param1, param2:param2}) then encoding with respect of the function function encodeURIComponent will make jQuery for you. In the case all ‘&’ characters and ‘paramX=’ strings will be also added for you.

    But the best way to use data parameter of the jQuery.ajax method. If you use

    jQuery.ajax({
        url: myUrl,
        data: {param1:param1, param2:param2},
        //...
    });
    

    then your URL will be appended with '?param1=' + param1 + '&param2' + param2 with the corresponding encoding full from jQuery.

    If my tips not helps you, please post your code example.

    UPDATED: After you posted test data it was clear, that you have no problem with ajax request. You show that the data of the server look like absolutely correct. So your problem is somewhere between PHP and MYSQL. I works with no from this two products and can now not really help you. Probably information from the following link could help you string issue of utf-8 encoding with PHP and MySQL?. You can try also

    mysql_query("SET NAMES 'utf8'"); 
    mysql_query("SET CHARACTER SET 'utf8'");
    

    I wish you much success and quick solving of your problem.
    Regards

    P.S. In your ajax request you can directly use data: {"english":"<?php echo $w;?>","addwords":translated}. The call jQuery.param will make jQquery for you because the type of data is not a string. But it’s absolutely independ on your problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 367k
  • Answers 368k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer From the TFS Admin console, have you tried going into… May 14, 2026 at 5:05 pm
  • Editorial Team
    Editorial Team added an answer You're actually over-thinking this. The idea behind web services is… May 14, 2026 at 5:05 pm
  • Editorial Team
    Editorial Team added an answer I'm a software engineer embedded in a team of research… May 14, 2026 at 5:05 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.