Solved

Perl and Celsius Symbo

Posted on 2011-02-18
6
468 Views
Last Modified: 2012-06-21
Hiya

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

John
0
Comment
Question by:IssacJones
  • 3
  • 3
6 Comments
 
LVL 5

Expert Comment

by:group0
Comment Utility
print "\xB0";
0
 

Author Comment

by:IssacJones
Comment Utility
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
 
LVL 5

Expert Comment

by:group0
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:IssacJones
Comment Utility
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
 

Author Comment

by:IssacJones
Comment Utility
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
 
LVL 5

Accepted Solution

by:
group0 earned 250 total points
Comment Utility
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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now