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

  • Home
  • SEARCH
  • 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 8528477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:48:36+00:00 2026-06-11T08:48:36+00:00

I wrote a short script which simply inserts Unicode characters into a MySQL database.

  • 0

I wrote a short script which simply inserts Unicode characters into a MySQL database. It looks like this:

mysql_connect('localhost', 'root', '*') or die(mysql_error());
mysql_select_db('test') or die(mysql_error());
mysql_query("INSERT INTO thetable (thefield) VALUES ('äöüß')") or die(mysql_error());

I generated the script using Notepad++ and it’s UTF-8 encoded without BOM.

The database and the table have a utf8_general_ci collation. When I look at the data using PhpMyAdmin then the charset seems to be broken. The characters are not displayed correctly:

äöüß

When I receive the data back in my script then the charset seems to be okay. I dumped it with the right header (header('Content-Type: text/html; charset=utf-8')) and everything looks right.

When I insert data into the table using PhpMyAdmin again, then it is displayed correctly inside PhpMyAdmin, but as soon as I dump it from my Demo script, then the charset is broken again.

I have no idea what the reason could be. The database’s charset, the HTTP header and the encoding of the script are consistent and I don’t doubt that PhpMyAdmin is working correctly. So where else could I look for the problem?

  • 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-06-11T08:48:37+00:00Added an answer on June 11, 2026 at 8:48 am

    Your getting 2 characters for every one in the original, so its reading it as standard ASCII instead of unicode. you probably need to specify the character set the MySQL Connection is using when you connect.

    I’m on my cell, but if u post your DB connect code I can show you how when I get to a computer

    Edit – see PHP PDO: charset, set names?

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

Sidebar

Related Questions

I wrote this short program which has a tiny GUI. Its supposed to allow
I have written this short script (which I've stripped away some minor detail for
I wrote a short bit of code to simply skip num_lines lines in an
To help me better understand lambda I wrote this short snippet that rotates and
I have a short question i have wrote this in java. Old code: class
I'm writing a script (show_volume.sh) which may be called several times in short intervals.
I would like to write Python script, which will get i.e. 100 news/texts from
I've this little script which does it's job pretty well but sometimes it tends
i'm using google gadget to write a short script and try to insert to
Sometimes I write very short assembly functions like function SeniorBit(Value: LongWord): Integer; asm OR

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.