Link to home
Start Free TrialLog in
Avatar of IssacJones
IssacJones

asked on

Perl and Celsius Symbo

Hiya

Can anybody tell me how to print to the console the Celsius symbol?

John
Avatar of group0
group0

print "\xB0";
Avatar of IssacJones

ASKER

Hi group0

That does not work for me. I simply get a character that looks like a hatched rectangle. I am using Windows 7.

John
Apparently extended ascii and unicode character set issues are fairly common on Windows.

Can you try running the following:
use utf8;
print "1: \x{00B0}\n";
print "2: " . chr(0x00B0) . "\n";
print "3: \x{00F8}\n";
print "4: " . chr(0x00F8) . "\n";

Open in new window


You can also try entering ALT-0176 or ALT-248 and see if either outputs the proper symbol when editing the source.
hi group0

3 and 4 work!!!!

I take it that there is some connection between 0176/248 and 00B0 and 00F8. What is the connection and how to I convert between the two?

John
Is there a way I can write the Perl code so it uses numbers like 248 (which I recognise) instead of the hex equivalent?

John
ASKER CERTIFIED SOLUTION
Avatar of group0
group0

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial