[PHP] Unicode problems

2008-09-25 Thread Thiago H. Pojda
This is slightly OT but I honestly don't know what else I can do.

I was asked to migrate a website from diff hosts. Okay, pretty easy, right?
Well, as usual, it wasn't.

Site pages content type was ISO-8559-1 and it was developed for a MySQL5
database that used latin1 as charset and InnoDB as storage system. Pretty
normal and ran smoothly.

The client database is a old 4.0 MySQL that (I'm not sure if they're just
disabled but it) doesn't have InnoDB and latin1. So I'm stuck with MyISAM
and UTF8. No, they can't change it - their hosting want them to migrate to
MSSQL and they can't switch hosts for whatever reason.

After I uploaded the files and ran it, my HTML files displayed correctly but
all accented chars that came from DB were displayed with weird chars, as I
imagined it would.

I then set my html content type to UTF-8 and I also had problems, but in
backwards this time - DB values were OK and website content was bad.

I couldn't find any good function/script to convert all my files to UTF-8
and then I built my own. It uses iconv and works like a charm. But
unfortunately I still can't get all pages to work. I have no idea why or
how, but *some* queries return the text in ISO-8859-1. I even dropped the
table and recreated them explictly saying it's a UTF8 table but some rows
are in ISO and others in UTF-8 (that or some mysql_fetch_* functions
converts them).

It's been 2 days and I still can't see a solution. I even thougth of adding
utf_decode on all of mysql_fetch* results, but I didn't build this website
so I don't feel like adding that in *every* call (it doesn't have a wrapper
for mysql_* functions).

So, I'm here to humbly ask for your help. What can be wrong?

PHP Version is 4.4.8

Thanks,
-- 
Thiago Henrique Pojda
http://nerdnaweb.blogspot.com


Re: [PHP] Unicode problems

2008-09-25 Thread Chris

Thiago H. Pojda wrote:

This is slightly OT but I honestly don't know what else I can do.

I was asked to migrate a website from diff hosts. Okay, pretty easy, right?
Well, as usual, it wasn't.

Site pages content type was ISO-8559-1 and it was developed for a MySQL5
database that used latin1 as charset and InnoDB as storage system. Pretty
normal and ran smoothly.

The client database is a old 4.0 MySQL that (I'm not sure if they're just
disabled but it) doesn't have InnoDB and latin1. So I'm stuck with MyISAM
and UTF8. No, they can't change it - their hosting want them to migrate to
MSSQL and they can't switch hosts for whatever reason.


Tried either of these?

http://dev.mysql.com/doc/refman/5.0/en/charset-convert.html
http://forums.mysql.com/read.php?10,52929,56552#msg-56552

--
Postgresql  php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php