utf 8 - How do I convert strings to utf-8 that are in a latin-1 field but where originally another charset in a MySQL SELECT query? -


i've got table lots of texts in different languages. table , fields iso-8859-1. data in fields encoded in different charsets before inserted. not converted latin1, shows gibberish. can 1 of these:

  • iso-8859-1
  • iso-8859-7
  • windows-1250
  • windows-1251
  • windows-1254
  • windows-1257

i know column maps kind of encoding.

what convert them utf-8 when select them, in way not show gibberish in final output.

my idea use convert(), the docs talking converting string encoding. string's encoding seems taken field's encoding. that's broken me.

here's example of data looks if @ directly in db.

Ðàä³àëüíà øèíà ïðèçíà÷åíà äëÿ áåçäîð³ææÿ.Ñïåö³àëüíî äëÿ land rover 

this supposed ukranian , encoded in cp1251 before being put latin1 field. if select foo bar without conversion , display webbrowser, telling use cp1251 show correctly cyrillic text in browser.

what think need ignore fact field latin1 , convert cp1251 utf8 (or utf8mb4).

however, not doing want:

select convert(foo_ua using 'cp1251') mytable; 

it comes out this, latin1 still in there.

????????? ???? ?????????? ??? ??????????.?????????? ??? land rover 

i tried cast() well, same result. how tell ignore latin1 , convert cp1251, , how go utf8 there?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -