Pergunta

We have scoured the web for a solution to this, but no luck yet...

We are using:

$output = strtoupper($input);    
Imagettftext($image, 27, 0, $start_x1, $start_y1, $color, 'font.ttf', strtok($output, ' '));

to write the first word of $output to $image.

This works fine in all cases EXCEPT for Ö,Ä,Ü. These get displayed as ö,ä,ü. Our .ttf DOES contain ALL characters.

We have tried converting $input using:

for ($i = 0; $i < strlen($input); $i++)
{
    $cc = ord($input{$i});
    if ($cc >= 128 || $cc == 38)
        $output .= "&#$cc;";
    else
        $output .= chr($cc);
}

but this DOESN'T work... Any ideas how we can fix this??

Thanks in advance for any help!!

Foi útil?

Solução

It likely has nothing to do with imagettftext. strtoupper is locale dependent and furthermore somewhat limited as far as supported encodings go. Use mb_strtoupper and tell it which encoding your string is in (likely UTF-8):

$output = mb_strtoupper($input, 'UTF-8');    

Outras dicas

You have to use mb_strtoupper.

It converts lowercase characters to correct uppercase characters.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top