help with celsius symbol

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
janne5011

help with celsius symbol

Post by janne5011 »

Ok heres how my problem looks:
http://3secs.ownit.nu/test.png
as you can see theres a "A" before the celsius symbol.

Here is how I put it:

I put it from textfile:
awk '{print " " $5 "\u2103"}' >sti.txt
after that theres no "A"
then convert
convert env LC_CTYPE=se_SE.utf8 -background snow -fill black -pointsize 18 -gravity Center label:@/home/janne/obb/sti.txt

Im on debian/ubuntu
How can I get rid of the annoying "A"?
Thanks in advance
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: help with celsius symbol

Post by fmw42 »

Don't know too much about this, but see Anthony's page about special escape characters for label

http://www.imagemagick.org/Usage/text/#escape_chars

also see the following about unicode characters

http://www.imagemagick.org/Usage/text/#unicode
janne5011

Re: help with celsius symbol

Post by janne5011 »

thanks for reply
I got the same problem with rrdtool ,another application.
after the awk line I got the
"°"
then it goes wrong.
maybe this can be putted another way?
convert env LC_CTYPE=se_SE.utf8
It dont helps.
in this page it says text in file shouldnt be affected
http://www.imagemagick.org/Usage/text/#escape_chars
but maybe I misunderstood that.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: help with celsius symbol

Post by fmw42 »

Does your file save text in UTF-8 encoding or something else like ISO-latin? Try ensuring the file is saved as utf-8
janne5011

Re: help with celsius symbol

Post by janne5011 »

fmw42 wrote:Does your file save text in UTF-8 encoding or something else like ISO-latin? Try ensuring the file is saved as utf-8
edit:
Here is output of "locale". And all files involved is on UTF-8 encoding. thats checked.

LANG=sv_SE.UTF-8
LC_CTYPE="sv_SE.UTF-8"
LC_NUMERIC="sv_SE.UTF-8"
LC_TIME="sv_SE.UTF-8"
LC_COLLATE="sv_SE.UTF-8"
LC_MONETARY="sv_SE.UTF-8"
LC_MESSAGES="sv_SE.UTF-8"
LC_PAPER="sv_SE.UTF-8"
LC_NAME="sv_SE.UTF-8"
LC_ADDRESS="sv_SE.UTF-8"
LC_TELEPHONE="sv_SE.UTF-8"
LC_MEASUREMENT="sv_SE.UTF-8"
LC_IDENTIFICATION="sv_SE.UTF-8"
LC_ALL=
janne5011

Re: help with celsius symbol

Post by janne5011 »

Solved
thanks to friend come up with the solution
changed this
awk '{print " " $5 "\u2103"}' >sti.txt
to awk '{print " " $5 "\260C"}' >sti.txt
:D
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: help with celsius symbol

Post by anthony »

From what I can see awk printf does not understand a '\u' escape for outputting a unicode character.

On the other hand the GNU "printf" command does..
env LC_CTYPE=en_AU.utf8 printf '\u2103'
which printed a circle-C type symbol.
Mind you I don't have the 'se' locale, so I used my normal australian locale, but unicode is international so the actual locale should not be too important here.

perl print also can generate unicode but again does so in a different way.
perl -e 'binmode(STDOUT, ":utf8"); print "\x{2103}\n"'

You may just need to be careful as to how you need generate unicode for each type of command you use.

ASIDE: "od" is you friend!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply