Convert UTF-8 textfile runtime bug

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
tltan
Posts: 2
Joined: 2018-12-06T20:06:47-07:00
Authentication code: 1152

Convert UTF-8 textfile runtime bug

Post by tltan »

I have a text file with contents as follows:
LINE 1
LINE 2
LINE 3

This file is saved as Normal.TXT (normal ANSI text file) and UTF8.TXT (UTF-8 format text file).

I ran the following commands:
convert -background white -fill black -font simhei -pointsize 60 -size 3020x caption:@Normal.TXT Output1.JPG
convert -background white -fill black -font simhei -pointsize 60 -size 3020x caption:@UTF8.TXT Output2.JPG

The first convert works fine, as expected.
The second convert has an unexpected problem. Output as follows:
LINE1
LINE2
LINE3

As you can see, LINE1 has been offset.

Anyone has any ideas how to fix this so that Output2 looks exactly like Output1? I need UTF-8 support because I need to support Chinese characters. Please help.
tltan
Posts: 2
Joined: 2018-12-06T20:06:47-07:00
Authentication code: 1152

Re: Convert UTF-8 textfile runtime bug

Post by tltan »

On the second output, Output2, the first line is offset with a couple of spaces in front of LINE1 (i.e. " LINE1"). Note: it did not show up correctly in my original post. Any help is much appreciated.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert UTF-8 textfile runtime bug

Post by fmw42 »

You do not say what version of ImageMagick, date and platform? Also what delegates and what version of freetype? Does simhei support UTF-8 characters? I do not see any offset. Perhaps you should post your output images to some free hosting service and put the URLs here.

__________________________

Please, always provide your IM version and platform when asking questions, since syntax may differ.

Also provide your exact command line and your images, if possible.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert UTF-8 textfile runtime bug

Post by snibgo »

I guess you use Windows, and your file was saved with a "Byte Order Mark" header. If so, the cure is to use software that doesn't write a BOM, or to strip the BOM after the file is saved.
snibgo's IM pages: im.snibgo.com
Post Reply