Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
543 views
in Technique[技术] by (71.8m points)

php - Convert latin1 to UTF8

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: פ×?ר×?×? ר×¢×? ×?פ×a×— ר×?×?×?×a! I want it to become normal hebrew characters.

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...