Jump to content

Encoding characters in mySQL


PhantomMask

Recommended Posts

I’ve just upgraded mySQL on my server from a very old system to the latest and now I’m finding it strips out characters when they are greater than ASCII 127. This new version has something called “Collation” that I have never encountered before. I think mine is set to “utf8_general_ci”. Anyway, here is my query that I’m using in PHP to add data to my DB:

 

INSERT INTO 'mytable' (message) VALUES ('$message')

It use to work fine before but now with the new version of mySQL, it’s faling when I add special charecters as those listed below

 

Hello World

Accented áéíóúó VVVVV

Apostrophe 1 "" WWWW

Apostrophe 2 '' XXXXX

Apostrophe 3 “” YYYYY

Apostrophe 4 ‘’ ZZZZZ

The quick brown fox kicks the butt of the lazy dog

Now, if I add the above text in to the DB, only the following gets inserted:

 

Hello World

Accented

As the DB removes all of the special characters.

Can anyone advise me?

 

I’m not a mySQL expert and these pages are not helping:

http://dev.mysql.com/doc/mysql/en/Charset.html

http://dev.mysql.com/doc/mysql/en/Charset-CONVERT.html

 

Any advice will be much appreciated.

Thank you kindly.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.