Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

mysql sql insert query language problem

Posted on 2013-05-29
6
Medium Priority
?
440 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
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 Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

688 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