homepage Welcome to WebmasterWorld Guest from 23.22.128.96
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
problems with converting character sets
not working as expected
LifeinAsia




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

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!

 

phranque




msg:4588353
 1:26 am on Jun 28, 2013 (gmt 0)

this might have some helpful information.

Converting your MySQL driven forum to UTF-8:
http://www.webmasterworld.com/community_building/4005526.htm [webmasterworld.com]

LifeinAsia




msg:4588358
 1:57 am on Jun 28, 2013 (gmt 0)

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. :(

lucy24




msg:4588376
 3:24 am on Jun 28, 2013 (gmt 0)

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.

LifeinAsia




msg:4588381
 3:39 am on Jun 28, 2013 (gmt 0)

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...

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved