[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-gtk-dev
Subject:    Re: [PHP-GTK-DEV] UTF-8 - how does the conversion work?
From:       Andrei Zmievski <andrei () gravitonic ! com>
Date:       2006-02-28 3:29:59
Message-ID: 274EF9B7-3417-4C21-BB9D-F07970929762 () gravitonic ! com
[Download RAW message or body]

PHP-GTK will automatically convert strings to UTF-8 when you pass  
data to it and from UTF-8 when you receive data. The character  
encoding it uses for conversion is specified as an INI entry php- 
gtk.codepage. It does not do any detection, it trusts you to set that  
INI entry properly.

If you have values in the database in iso-8859-14, but code is in  
utf-8 then you have two options.

1) Do conversion manually. Use iconv() or mbstring_convert_encoding()  
to convert the database data to UTF-8 encoding and pass the data to  
PHP-GTK.
2) Set php-gtk.codepage to iso-8859-14 before calling PHP-GTK  
functions with the database data and reset it back to UTF-8 after  
you're done. You have to make sure that all the data you pass to PHP- 
GTK is in the same iso-8859-14 encoding though, so if you mix string  
literals and database data you may have issues.

-Andrei


On Feb 27, 2006, at 8:20 AM, Christian Weiske wrote:

> Hello readers, especiall Andrei,
>
>
> How does the utf8 conversion work? All I know is that it should be  
> done
> automatically. How does php-gtk detect which charset the data are?
> Does it try the php code file encoding?
>
> What if I have values from database in iso-8859-14, but my code is  
> utf-8?
>
> -- 
> Regards/MfG,
> Christian Weiske


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic