Re: imagettftext and utf-8 (swedish characters)

From: Date: Fri, 29 Feb 2008 23:39:09 +0000
Subject: Re: imagettftext and utf-8 (swedish characters)
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-270787@lists.php.net to get a copy of this message
Jochem Maas skrev:
Jochem Maas schreef:
have you tried a test script (file encoded as UTF8) where you hardcode the title string and see if that also outputs 'squares' ... at least that way you can be sure whether the problem is in some kind of encoding mush that occurs during the title's roundtrip of server -> browser -> server OR whether the problem is actually to do with imagetfftext.
I tried in on my local machine (php5.2.5) and I can output swedish characters no problem (I hope the below test script comes through with borking the UTF-8 chars) <?php set_time_limit(0); //$title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8'); //$title = 'åååååååå bork'; //$title = 'Pippi Långstrump går om bord'; /* $title = 'Alla människor är födda fria och lika i värde och rättigheter. De är utrustade med förnuft och samvete och bör handla gentemot varandra i en anda av broderskap.'; //*/ $title = 'hå kå Å å Ä ä Ö ö å ö'; ///@note Hardcoded resolution
$im     = imagecreatetruecolor(400, 200);
$black = imagecolorallocate($im, 0, 0, 0); $white = imagecolorallocate($im, 255, 255, 255); //$font = "/Applications/OpenOffice.org 2.3.app/Contents/share/fonts/truetype/Georgia.ttf"; $font = "/Library/Fonts/Georgia.ttf"; $title_size = 18; imagefilledrectangle($im, 0, 0, 800, 600, $black); imagettftext( $im, $title_size, 0, 20, 40, $white, $font, $title ); header("Content-Type: image/png"); imagepng($im); exit(); It does sadly not work:
*Warning*: imagettftext() [function.imagettftext <http://83.209.20.148/function.imagettftext>]: any2eucjp(): invalid code in input string in */home/ext/workspace/code/trunk/Projects/Slideshow/frontend/public/foo.php* on line *30 *If I suppress the warning I get an image with squares and random letters. Is something wrong with my php installation? linux-2.6.24-gentoo PHP 5.2.5-p20080206-pl3-gentoo Apache/2.2.8 './configure' '--prefix=/usr/lib64/php5' '--host=x86_64-pc-linux-gnu' '--mandir=/usr/lib64/php5/man' '--infodir=/usr/lib64/php5/info' '--sysconfdir=/etc' '--cache-file=./config.cache' '--with-libdir=lib64' '--enable-maintainer-zts' '--disable-cli' '--with-apxs2=/usr/sbin/apxs2' '--with-config-file-path=/etc/php/apache2-php5' '--with-config-file-scan-dir=/etc/php/apache2-php5/ext-active' '--without-pear' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--with-curl' '--with-curlwrappers' '--disable-dbase' '--enable-exif' '--without-fbsql' '--without-fdftk' '--enable-ftp' '--with-gettext' '--with-gmp' '--with-kerberos=/usr' '--enable-mbstring' '--with-mcrypt' '--with-mhash' '--without-msql' '--without-mssql' '--with-ncurses' '--with-openssl' '--with-openssl-dir=/usr' '--enable-pcntl' '--without-pgsql' '--with-pspell' '--without-recode' '--disable-shmop' '--with-snmp' '--enable-soap' '--enable-sockets' '--without-sybase' '--without-sybase-ct' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--with-tidy' '--disable-wddx' '--with-xmlrpc' '--with-xsl' '--enable-zip' '--with-zlib' '--disable-debug' '--enable-dba' '--with-cdb' '--with-db4' '--with-flatfile' '--with-gdbm' '--with-inifile' '--without-qdbm' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--enable-gd-jis-conv' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-gd' '--with-imap' '--with-imap-ssl' '--with-ldap' '--without-ldap-sasl' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--without-mysqli' '--with-unixODBC=/usr' '--without-adabas' '--without-birdstep' '--without-dbmaker' '--without-empress' '--without-esoob' '--without-ibm-db2' '--without-iodbc' '--without-sapdb' '--without-solid' '--without-pdo-dblib' '--with-pdo-mysql=/usr' '--with-pdo-odbc=unixODBC,/usr' '--without-pdo-pgsql' '--with-pdo-sqlite=/usr' '--without-readline' '--with-libedit' '--without-mm' '--with-sqlite=/usr' '--enable-sqlite-utf8'

« previous php.general (#270787) next »