Jump to content


Photo

Viewing Tabledata In Utf8


  • Please log in to reply
11 replies to this topic

#1 ErikEgon

ErikEgon

    Member

  • Members
  • PipPip
  • 11 posts

Posted 01 January 2012 - 10:54 AM

I am in a country where extended characters matter. The database default characterset is UTF8 and data is correctly entered in and retrieved from the database. Representation in the website is also OK.

When querying the database using SQLYog extended characters are displayed as two seperate symbols: an é is represented as é. I am using Consolas as the display font and changing it to Times New Roman or Arial doesn't change a thing. Starting a query with SET NAMES UTF8 doesn't help either.

Posted Image

How can I display tabledata as the characters they were entered?

Kind regards,
Erik.

#2 peterlaursen

peterlaursen

    Advanced Member

  • Admin
  • PipPipPip
  • 7,869 posts
  • Gender:Male
  • Location:Skagen, Denmark
  • Interests:well ... jazz/folk music, photography, chess, nature, ecology, history, bicycling, Highland Malts ... well, Lowland Malts and Cognac too actually :-) just wonder how I get the time to touch a computer! SQLyog and MONyog? no that's not interest, that's BASIC NEEDS simply!

Posted 01 January 2012 - 12:57 PM

Please read this FAQ: http://webyog.com/fa...-in-sqlyog.html

This is not a bug. This is a typical 'doble encoding' issue. The client encodes where it should not (the server should do it).




It does not matter that

1) The database default characterset is UTF8 if tables or columns are still latin.

2) Representation in the website is also OK.. PHP etc. will decode client side




You can verify for yourself:

1) Enter data with SQLyog. Now they display OK, right?

2) Dump the table (with mysqldump or SQLyog - not phpMyAdmin or any other PHP tool). Now open in Notepad or another editor that supports UTF8. Here you will see data display exactly like in SQLyog. Right?

3) Try watching the same data in a GUI tool from MySQL/Oracle (Query Browser or Workbench).
Computers make your grey hair come off ....

Peter Laursen
Webyog

#3 peterlaursen

peterlaursen

    Advanced Member

  • Admin
  • PipPipPip
  • 7,869 posts
  • Gender:Male
  • Location:Skagen, Denmark
  • Interests:well ... jazz/folk music, photography, chess, nature, ecology, history, bicycling, Highland Malts ... well, Lowland Malts and Cognac too actually :-) just wonder how I get the time to touch a computer! SQLyog and MONyog? no that's not interest, that's BASIC NEEDS simply!

Posted 01 January 2012 - 01:01 PM

 .. and fonts are completely irrelevant for the discussion BTW. 
Computers make your grey hair come off ....

Peter Laursen
Webyog

#4 ErikEgon

ErikEgon

    Member

  • Members
  • PipPip
  • 11 posts

Posted 01 January 2012 - 06:29 PM

Hi Peter,

Thank you for responding at such short notice. Still chewing in the information.

Okay, so how do I go about when I need:

1. A website where customers must leave personal data (first and lastnames with extended characters do happen)
2. A database that supports extended characters (I need to store the data)
3. An easy GUI like SQLYog to printout readable data when querying

This is the setup:
1. The webpage (meta http-equiv="Content-Type" content="text/html; charset=utf-8") is in UTF-8.
2. I told the form (accept-charset="utf-8") it should send all entered data in UTF-8.
3. I setup the PHP database connection using SET NAMES 'utf8'
4. Created a test database with default characterset utf8
5. Created a table with Character Set = utf8, Collation = utf8_general_ci
6. All varchar columns are in Character Set = utf8, Collation = utf8_general_ci
7. Retrieving previously entered data from the database is correctly displayed, without the help of any PHP function, in the test page.
8. In MySQL the data is displayed as mentioned in the first post.

What is wrong? If you could share any thoughts, it would be much appreciated, not just by me ....

Never thought this was a MySQL bug ...

Happy new year!

Erik.

#5 ErikEgon

ErikEgon

    Member

  • Members
  • PipPip
  • 11 posts

Posted 01 January 2012 - 07:31 PM

Peter,

When I dump the table on my local PC the data in the file shows, as you expected, two characters for a simple .

I thought that telling MySQL it should expect UTF-8 data it would accept and understand multibyte characters and store it as multibyte characters. And apparently, it does.

So I would rather expect that I should create a SQLYog UTF-8 connection so that SQLYog would send UTF-8 data and accept and display UTF-8 data on return.

Stil unsure if this is a situation that has a 100% satisfying answer: perhaps all my wishes just don't mix.



Regards,
Erik.

#6 peterlaursen

peterlaursen

    Advanced Member

  • Admin
  • PipPipPip
  • 7,869 posts
  • Gender:Male
  • Location:Skagen, Denmark
  • Interests:well ... jazz/folk music, photography, chess, nature, ecology, history, bicycling, Highland Malts ... well, Lowland Malts and Cognac too actually :-) just wonder how I get the time to touch a computer! SQLyog and MONyog? no that's not interest, that's BASIC NEEDS simply!

Posted 01 January 2012 - 08:16 PM

Maybe you could share a small 'project' consisting of a table dump + what HTML and/or PHP files are involved to demonstrate the issue. .If you don't want to post in public please create a support ticket by sending a mail to support@webyog.com. A very small 'project' (like a table with 5 rows and a PHP file with 20 lines!) would be best.

It it no secret that we had similar complaints over time. I am no web developer myself, but we have a bunch of engineers in our SQLyog team and also our teams taking care of our IssueBurner application (http://issueburner.com/) and the developer team taking care of our website and Customer Portal. They are all PHP applications using a MySQL backend with UTF8 data. We dont face this issue with any of those apps. So undoubtedly we can advise.

The dump tells what is stored in the database just like SQLyog does. Some clients may decode it. But we believe that server alone should encode and decode (from/to character_set_client and character set used for storage).




BTW: When you wrote "8. In MySQL the data is displayed as mentioned in the first post." I think you meant "8. In *SQLyog* ..." . Right? Did you try other clients?


Computers make your grey hair come off ....

Peter Laursen
Webyog

#7 ErikEgon

ErikEgon

    Member

  • Members
  • PipPip
  • 11 posts

Posted 02 January 2012 - 07:57 PM

BTW: When you wrote "8. In MySQL the data is displayed as mentioned in the first post." I think you meant "8. In *SQLyog* ..." . Right? Did you try other clients?

Yes, SQLyog was what I meant indeed. But I also checked this on the commandline using Putty a few minutes ago and the mysql client tool gives me the exact same results.

I'd be more than happy to share. I think this is an issue that headaches not only me!

Please find attach a zip file containing a very, very basic "index.php" that lets one insert records in a database and immediately displays the results. It also contains the test database containing the table and one example record.


Regards,
Erik.

#8 ErikEgon

ErikEgon

    Member

  • Members
  • PipPip
  • 11 posts

Posted 02 January 2012 - 07:58 PM

Sorry, lost the attachment, I think. Another try ...

#9 ashwin

ashwin

    Advanced Member

  • Members
  • PipPipPip
  • 275 posts
  • Gender:Male
  • Location:Bangalore, India

Posted 03 January 2012 - 09:04 AM

Follow these steps to attach files here:

1) Click on "Add Reply". ("Fast reply" option does not have an option to attach files)
2) Below the editor there is an Attachment section.
3) Here, click on browse to select the required file.
4) Now click on "Attach This File".

#10 peterlaursen

peterlaursen

    Advanced Member

  • Admin
  • PipPipPip
  • 7,869 posts
  • Gender:Male
  • Location:Skagen, Denmark
  • Interests:well ... jazz/folk music, photography, chess, nature, ecology, history, bicycling, Highland Malts ... well, Lowland Malts and Cognac too actually :-) just wonder how I get the time to touch a computer! SQLyog and MONyog? no that's not interest, that's BASIC NEEDS simply!

Posted 03 January 2012 - 10:30 AM

and a 5th step (optional):

You may click the 'attach to post' link and something like

[attachment=1680:file.name]
.. will display. This you may copy where you want if you want the thumbnail to appear a specific place.


If you are not able to attach files here for some reason please try to .zip what you have or create a support ticket by sending a mail to support@webyog.com.The file format may not be supported here or the file may be too big.
Computers make your grey hair come off ....

Peter Laursen
Webyog

#11 ErikEgon

ErikEgon

    Member

  • Members
  • PipPip
  • 11 posts

Posted 03 January 2012 - 12:18 PM

I've just sent it through the mail. The zip-file is very small: 1,798 bytes.

#12 peterlaursen

peterlaursen

    Advanced Member

  • Admin
  • PipPipPip
  • 7,869 posts
  • Gender:Male
  • Location:Skagen, Denmark
  • Interests:well ... jazz/folk music, photography, chess, nature, ecology, history, bicycling, Highland Malts ... well, Lowland Malts and Cognac too actually :-) just wonder how I get the time to touch a computer! SQLyog and MONyog? no that's not interest, that's BASIC NEEDS simply!

Posted 03 January 2012 - 12:58 PM

We received the mail but there is no attachment.  Are you sure that you don't have a very restrictive mail etc. filter setting removing attacments with any Kind of code inside (even PHP scripts)? 
Computers make your grey hair come off ....

Peter Laursen
Webyog




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users