Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert latin1 to UTF8

Tags:

php

mysql

I have a DB - with the table articles.

I want to convert the title, and content field to utf8 now - all data looks like this: פורטל רעל נפתח רשמית! I want it to become normal hebrew characters.

Thanks

like image 593
WEBProject Avatar asked Mar 08 '11 12:03

WEBProject


1 Answers

if you need to convert the whole database , you can back it as databaseback.sql file then form your command line iconv -f latain -t utf-8 < databaseback.sql > databaseback.utf8.sql

you can use the http://www.php.net/manual/en/function.iconv.php
to convert each row in php in case you don't have command line access

and lastly don't forget to convert the collation of each field in phpmyadmin , then you can resotre the utf8 back easily

update

if you got iconv is not recognized , it means that you don't have iconv installed

much more easier solution is : Migrating MySQL Data to Unicode

http://daveyshafik.com/archives/166-migrating-mysql-data-to-unicode.html

like image 95
tawfekov Avatar answered Nov 07 '22 22:11

tawfekov