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 6046235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:12:55+00:00 2026-05-23T07:12:55+00:00

Relevent code: $status = $db->run( INSERT INTO user_wall (accountID, fromID, text, datetime) VALUES (:toID,

  • 0

Relevent code:

$status = $db->run(
    "INSERT INTO user_wall (accountID, fromID, text, datetime) VALUES (:toID, :fromID, :text, '" . time() . "')",
    array(":toID" => $toID, ":fromID" => %accountID, ":text" => $text)
);

I am taking input text from javascript, throwing it in an AJAX call to handle it, which calls a function which includes these lines of code.

The text string in question is: “Türkçe Türkçe Türkçe!“

Upon investigating the database, the following value is saved “Türkçe Türkçe Türkçe!“, which is double utf8_encode’d.

When viewing the text by SELECTing it from the database, I get “Türkçe Türkçe Türkçe!“, which is how they should be saved in the database in the first place.

As far as I know, I am not encoding the data as it is being prepared by PDO…

  • 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-23T07:12:56+00:00Added an answer on May 23, 2026 at 7:12 am

    Encoding is a b*tch. You need to make sure it is as you expect it to be in several places:

    1. The HTML page with the Javascript. Set it to utf-8 with a meta tag like:
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    2. The connection to your database. Execute the query set names 'utf8' after connecting to the database (and before any other queries).

    3. Your database field. In MySQL it’s called a collation set it to utf8_general_ci (ci stands for case-insensitive).

    If you have these 3 your data should always be, and stay, utf-8 (unless you’re doing encoding yourself).

    For good measure, make sure your source code files are utf-8 as well. Windows typically defaults to iso.

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

Sidebar

Related Questions

I'm embedding MSBuild directly into a more complex build tool. The relevant code looks
I'm serving up an image from a database using an IHttpHandler. The relevant code
I'm writing an Android app for work that shows the status of our phone
I've wrote a service that should start/stop other services. This is the code I'm
I'm having a really hard time figuring out the scoping issue with the following
I'm attempting to turn a web interface into an Android one by parsing the
Is PHP still a relevant language in 2017?
Just looking for the relevant documentation. An example is not necessary, but would be
My question is quite relevant to something asked before but I need some practical
When I need some complex algorithm I first check if there's anything relevant already

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.