Micheasl
Micheasl

Reputation: 287

Php utf8_decode() not working with A–Z

I am creating an Image with Image which shall have this text: A–Z

but somehow the Long dash does not Show properly instead of the dash the string get shown.

How is it possible to make this line work:

utf8_decode('A–Z');

So that it Shows

A-Z with a Long dash.

Currently it just Returns the string in the parameter:

EDIT

The complete function:

protected function createImg($font = 'Helvetica-LT-55-Roman')
{
    $borderPadding = '50x0';
    $calcWidth     = 720;
    $calcSize      = $calcWidth . 'x520';

    $textEdu = utf8_decode('Lorem Ipsum A–Z Lorem Ipsum');

    $command = env('IMCONVERT', '') . ' -size ' . $calcSize . ' -background transparent -fill white -font ' . $font . ' -pointsize 22 -gravity west -interline-spacing 5 label:"' . $textEdu . '" -matte -bordercolor none -border ' . $borderPadding . ' -strokewidth 1 -stroke white -fill none -draw "line 203,100" ' . $this->path . 'menu\\ímg.png';

    return $command;
    // In my constructor() I just Shell_exec() the function and the Image gets created
}

Upvotes: 1

Views: 1439

Answers (1)

Remco K.
Remco K.

Reputation: 717

You use a HTML entity here. So utf8 decode doesn't do anything. To decode html entities you can use:

html_entity_decode('A–Z');

Link: http://php.net/manual/en/function.html-entity-decode.php

Upvotes: 1

Related Questions