Welcome to WebmasterWorld Guest from 54.211.5.239

Forum Moderators: open

Message Too Old, No Replies

problems with converting character sets

not working as expected

     
1:16 am on Jun 28, 2013 (gmt 0)

Moderator from US 

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 10, 2005
posts:5634
votes: 51


I have legacy data that was stored in a MS SQL table in euc-kr character set. It all displays well on legacy pages that use the euc-kr character set. But we want to migrate everything to UTF-8.

I have migrated the table to MySQL and am trying to convert the characters to UTF-8.

In PHP, I can grab the data and convert it with:
$Col2=iconv("EUC-KR","UTF-8",odbc_result($rs,"Col1"));
and it displays correctly in UTF-8. But when I try to put it back into the database, the characters don't show as UTF-8.

I have tried the following directly in MySQL, but the data is not being saved in UTF-8 format:
UPDATE TableName SET
Col2=CONVERT(CONVERT(Col1 USING binary) USING utf8)

I have tried numerous combinations of euckr, latin1, utf8, binary- nothing works correctly.

I'm still fairly new to MySQL, so I'm hoping it's something trivial that I'm doing wrong. At least I hope so- I don't have much more hair left to pull out!

TIA!
1:26 am on June 28, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10589
votes: 21


this might have some helpful information.

Converting your MySQL driven forum to UTF-8:
http://www.webmasterworld.com/community_building/4005526.htm [webmasterworld.com]
1:57 am on June 28, 2013 (gmt 0)

Moderator from US 

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 10, 2005
posts:5634
votes: 51


We have a Windows environment, so some of the steps don't apply. But I've made all the other applicable changes. Still no go. :(
3:24 am on June 28, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:13255
votes: 359


But when I try to put it back into the database, the characters don't show as UTF-8.

The same database, or a new one? (That is, a separate physical file.)

Got a nasty feeling your database is digging in its heels and refusing to cooperate because it can't convert and reinterpret at the same time.
3:39 am on June 28, 2013 (gmt 0)

Moderator from US 

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 10, 2005
posts:5634
votes: 51


because it can't convert and reinterpret at the same time.

Same DB file. For that scenario, PHP is handling the conversion. So the DB *should* just handle the UPDATE statement like any other update statement.

I'm in the process of getting a DEV server up to speed that will be a traditional LAMP environment. Hoping for better luck once Windoze is completely out of the equation...