From:             bengt at sm7jqb dot se
Operating system: RedHat Linux 7.3
PHP version:      4.4.2
PHP Bug Type:     GD related
Bug description:  I got wrong letter Å and å !

Description:
------------
This line prtoduse vrong letter 'Å' and 'å' !
<br />
<img
src="http://sm7jqb.se/PHP/knappjpeg.php?bild=knapp&text=Test-ÅÄÖ-åäö&font=3&height=20";>
 *.jpeg

Is that bug fixed in the new 4.4.2 ?


Reproduce code:
---------------
<?php
header("Content-type: image/jpeg");
$text = $_GET['text'];
$bild = $_GET['bild'];
if ( !$_GET['font'] ) $font = 3; else $font = $_GET['font'];

$bgimg = imagecreatefromjpeg("./bild/".$bild.".jpg");
if ( !$_GET['height'] ) 
        $height = imagesy($bgimg); else $height = $_GET['height'];

//      Gör en lagom stor ny bild
if ( $width < ((strlen($text)*9.0)+11)) 
        $width = (strlen($text)*9.0)+11;

$im = imagecreate($width, $height);
$bgc = imagecolorallocate($im, 255, 255, 200);
$black = imagecolorallocate($im, 0, 0, 0);
$grey = imagecolorallocate($im, 100, 100, 100);
$ltgrey = imagecolorallocate($im, 250, 250, 250);

imagefill($im,0,0,$bgc);


//      Vänster del
$dst_x = 0;
$dst_y = 0;
$src_x = 0;
$src_y = 0;
if ( imagesx($bgimg) < ((int)imagesx($im)/2+0.9) )      $src_w =
((int)imagesx($bgimg)/2+0.9);   else    
$src_w = ((int)imagesx($im)/2+0.9);
$src_h = imagesy($im);
imageCopyMerge($im, $bgimg, $dst_x, $dst_y, $src_x, $src_y, $src_w,
$src_h, 100);

$dst_x = $src_w;
$src_x = imagesx($bgimg)-$src_w;

while ( ($dst_x+$src_w) < (imagesx($im)-$src_w) ) {
        $src_x = 1;
imageCopyMerge($im, $bgimg, $dst_x, $dst_y, $src_x, $src_y, $src_w,
$src_h, 100);
        $dst_x += $src_w-1;
        }

//      Höger del
if ( imagesx($bgimg) < ((int)imagesx($im)/2+0.9) ) {
        $src_w = imagesx($bgimg);       
        $src_x = 1;     
        }
        else 
        $src_w = ((int)imagesx($im)/2+1.9);
$dst_x = imagesx($im) - $src_w + 1;
imageCopyMerge($im, $bgimg, $dst_x, $dst_y, $src_x, $src_y, $src_w,
$src_h, 100);


//      Lägg på texten
$px    = (imagesx($im) - 7.0 * strlen($text)) / 2;
$py        = (imagesy($im) - 13.0) / 2;

if ( $_GET['shadow'] == 'grey' ) 
        imagestring($im, $font, $px+2, $py+2, $text, $grey);
if ( $_GET['shadow'] == 'ltgrey' ) 
        imagestring($im, $font, $px+2, $py+2, $text, $ltgrey);
imagestring($im, $font, $px, $py, $text, $black);
imagejpeg($im);
imagedestroy($im);
imagedestroy($bgimg);
?> 


Expected result:
----------------
I vant the text on my button but I got wrong letter 'Å' and 'å'

Try it!


Actual result:
--------------
You can run the script your self to se

http://www.sm7jqb.se/PHP/knappjpeg.php?bild=knapp&text=Test-ÅÄÖ-åäö&font=3&height=20

Thanks!

-- 
Edit bug report at http://bugs.php.net/?id=37009&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37009&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=37009&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37009&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37009&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37009&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37009&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37009&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37009&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37009&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37009&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37009&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37009&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37009&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37009&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37009&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37009&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37009&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37009&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37009&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37009&r=mysqlcfg

Reply via email to