Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

mysql sql insert query language problem

Posted on 2013-05-29
6
Medium Priority
?
441 Views
Last Modified: 2013-06-03
I have a Turkish character problem when use my insert query.
I see the table with unkown charcters when I use a Turkish character like Ö or Ü
what should I do?
0
Comment
Question by:Braveheartli
6 Comments
 
LVL 41

Expert Comment

by:Sharath
ID: 39205366
There is a solution provided in this link. Check this.

http://www.bothernomore.com/2008/12/16/character-encoding-hell/

extracted from the above page.

alter table TABLE_NAME modify FIELD_NAME blob;
alter database DATABASE_NAME charset=utf8;
alter table TABLE_NAME modify FIELD_NAME varchar(255) character set utf8;
0
 
LVL 1

Author Comment

by:Braveheartli
ID: 39205439
Sharath_123 i doesn't work.
I have just tried.
0
 
LVL 23

Expert Comment

by:nemws1
ID: 39205517
try issuing this:

set character set 'utf8';

And then try Sharath_123's suggestion.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:Braveheartli
ID: 39205537
My sql table looks like this...
Untitled-1.png
0
 
LVL 23

Expert Comment

by:nemws1
ID: 39206072
Ugh.  PHPmyAdmin.  Which *should* work correctly with UTF8.  Are you sure your data was imported correctly?  The same settings we've mentioned here need to be set when the data is loaded as well!
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 39207411
There are, potentially, a lot of moving parts to this question.  Begin your learning adventure here.
http://www.joelonsoftware.com/articles/Unicode.html

Then read this PHP script.  You can see its output on my server.
http://www.laprbass.com/RAY_temp_braveheartli.php

<?php // RAY_temp_braveheartli.php
error_reporting(E_ALL);

// SEE http://www.experts-exchange.com/Database/MySQL/Q_28142046.html

$chr = 'Ö';
echo "CHARACTER $chr HAS STRLEN " . strlen($chr);

Open in new window

The fact that the script shows a string length of 1 for the $chr variable is significant.  I used copy/paste to recover that character from this EE web page and put it into my script.  If it has a string length of 1, it is not UTF-8 encoded.  The O-Umlaut would be a two-byte character in UTF-8.  This is probably something like ISO-8859-1 encoding.

Character encoding must be consistent throughout all of your processing, and that means that your text editor, your PHP scripts, your data base, and your generated HTML must all be correct and in consonance for you to get the correct output.

What I think I am seeing when I look at the phpMyAdmin image is a mix of UTF-8 characters and Western Latin characters.  I say that because the upper-case accented A occurs frequently in improperly encoded UTF-8 strings.  It is a symptom of taking a UTF-8 character and storing it in the form of a Western character set, where the two-byte UTF-8 character gets turned into two separate Western characters of one byte each.
http://filedb.experts-exchange.com/incoming/2013/05_w22/657154/Untitled-1.png

So my advice would be to check all elements of the character encoding and attempt to be consistent throughout.  If you're using PHP, you need to learn about how PHP handles character strings, and about how this is changing as PHP is modernized.  Some links tell how this works:
http://php.net/manual/en/language.types.string.php
http://php.net/manual/en/language.types.string.php#language.types.string.details

An important quote from the man page:  Using functions that can handle Unicode encodings is just the beginning. No matter the functions the language provides, it is essential to know the Unicode specification. For instance, a program that assumes there is only uppercase and lowercase is making a wrong assumption.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question