How can i type degree symbol on Ruby?

Thread Starter

erickzind

Joined Sep 16, 2019
2
Does anyone here knows how to display the 'degree' symbol in a string (Ruby.)?

I’m trying to display the degree symbol (the one used for temperature
or latitude/longitude coordinates).

I tried to use 167.chr , but the output on the website is ‘?’.

Code: degrees = [number_with_precision(degrees, precision=0),
167.chr, " ", number_with_precision(minutes, precision=0), "’ “,
number_with_precision(decimal_seconds, precision=2), '”’]

HTML Output: 37? 32’ 55.51"
 

KeithWalker

Joined Jul 10, 2017
526
Does anyone here knows how to display the 'degree' symbol in a string (Ruby.)?

I’m trying to display the degree symbol (the one used for temperature
or latitude/longitude coordinates).

I tried to use 167.chr , but the output on the website is ‘?’.

Code: degrees = [number_with_precision(degrees, precision=0),
167.chr, " ", number_with_precision(minutes, precision=0), "’ “,
number_with_precision(decimal_seconds, precision=2), '”’]

HTML Output: 37? 32’ 55.51"
Hold down the "Alt" key and type "0176" on the numbers keypad. It will not work if you use the numbers at the top of the standard qwerty keyboard.
 
Top