Caption error with french accent

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
zakdo
Posts: 2
Joined: 2013-04-03T14:51:14-07:00
Authentication code: 6789

Caption error with french accent

Post by zakdo »

Hi!

I am getting wrong output character when using caption with french accent. Example:

Code: Select all

@ECHO OFF
  convert -background lightblue -fill blue -gravity center  ^
          -font "C:\Windows\Fonts\timesbd.ttf"  ^
          -size 292x208   caption:"Test With accent â ù é"  ^
           C:\Users\ZAK\Desktop\output.gif
results in:
Image

(note we don't have "â ù é")

my convert version is:

Code: Select all

C:\Users\ZAK>convert --version
Version: ImageMagick 6.8.4-6 2013-04-01 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib fontconfig freetype jng jp2 jpeg lcms lzma pango png ps tiff x
xml zlib
Thx
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Caption error with french accent

Post by magick »

Convert your text to UTF8 and make sure your font supports UTF8 encoding. We standardized on UTF8 because its supported both under Linux and Windows.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Caption error with french accent

Post by snibgo »

I find the Windows command processor usually mucks up commands containing UTF-8 text. I'm sure there is a workaround, but I don't know what it is.

Instead, I put the text in a file, saved as UTF-8, and "@" caption. Thus ...

Code: Select all

"%IMG%convert" -background lightblue -fill blue -gravity center  ^
          -font "C:\Windows\Fonts\timesbd.ttf"  ^
          -size 292x208   caption:@capt.txt  ^
           output.gif
... where capt.txt is a text file, saved with Notepad as UTF-8, containing:

Code: Select all

Test With accent â ù é
snibgo's IM pages: im.snibgo.com
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Caption error with french accent

Post by anthony »

Future...

In IMv7, the "magick" scripting will should not muck up UTF-8.

Using "magick" scripting should make IM scripts more portible between all machines as it avoids DOS or Shell script interpretations.

However there are quite a number of things that still needs to be added to make "magick-scripting" useful, such as script argument handling.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
zakdo
Posts: 2
Joined: 2013-04-03T14:51:14-07:00
Authentication code: 6789

Re: Caption error with french accent

Post by zakdo »

Hi,
I solved my problem by using "chcp 1252" in DOS for converting to ANSI character :

Code: Select all

    @ECHO OFF
    chcp 1252
      convert -background lightblue -fill blue -gravity center  ^
              -font "C:\Windows\Fonts\timesbd.ttf"  ^
              -size 292x208   caption:"Test With accent â ù é"  ^
               C:\Users\ZAK\Desktop\output.gif
Thanks
Post Reply