Perl and Celsius Symbo

Hiya

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

John
IssacJonesAsked:
Who is Participating?
 
group0Commented:
Yes, 176 in hex is B0 and 248 is F8.  To use the decimal version, use chr() without a leading 0x:

print chr(248) . "\n";

Open in new window

0
 
group0Commented:
print "\xB0";
0
 
IssacJonesAuthor Commented:
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
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
group0Commented:
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.
0
 
IssacJonesAuthor Commented:
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
0
 
IssacJonesAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.