Page 1 of 1

help with celsius symbol

Posted: 2008-09-20T10:41:12-07:00
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

Re: help with celsius symbol

Posted: 2008-09-20T15:22:22-07:00
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

Re: help with celsius symbol

Posted: 2008-09-20T16:43:42-07:00
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.

Re: help with celsius symbol

Posted: 2008-09-21T14:18:23-07:00
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

Re: help with celsius symbol

Posted: 2008-09-21T14:55:50-07:00
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=

Re: help with celsius symbol

Posted: 2008-09-21T16:02:12-07:00
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

Re: help with celsius symbol

Posted: 2008-09-21T17:09:33-07:00
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!