php - Mysql only update if where data is in latin8 -


i have statement works in first run

update accounts set username = convert(cast(convert(username using latin1) binary) using utf8) 

this convert latin1 characters utf8 chinese character in mysql.

running 2nd time, character become weird.

how add in where condition update username utf8 latin1 if word in latin1

what character set column? if still latin1, asking lot of trouble.

a table declared latin1, , containing latin1 bytes can converted utf8 via

alter table tbl convert character set utf8; 

after (and assuming have set names set correctly), text converted utf8 inserted. no need flag; no need second pass; etc.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -