Displaying degree symbol on webpage

17,236

Solution 1

See DEGREE CHARACTER.

Specifically, HTML Entity: °.

Check that you have the proper docstring and character encoding in both templates to make sure they are correct.

Solution 2

You can use:

utf8_encode('YOUR TEXT');

utf8_encode converts the string data from the ISO-8859-1 encoding to UTF-8.

Solution 3

  1. Save your PHP file with UTF-8 encoding.
  2. Serve your PHP file with charset=UTF-8.
  3. Add a META-tag in your HTML with charset=UTF-8.

This will solve (almost) all of your unicode character problems.

Share:
17,236
Steven Mclaren
Author by

Steven Mclaren

Updated on June 11, 2022

Comments

  • Steven Mclaren
    Steven Mclaren about 2 years

    I have a program which extracts GPS coordinates from metadata and imports the results onto a database. I then display the data using PHP on a webpage.

    My problem - I've recently created a new template but for whatever reason, it is no longer showing the degrees symbol '°' but a '�'.

    I just find it strange that it works with one template, but not the other?

    I've tried changing fonts, but had no luck

  • Steven Mclaren
    Steven Mclaren over 11 years
    Rygu - Thanks. Although this wasn't the way I corrected things, it did point me in the right direction. Deleting the line: <meta http-equiv="Content-Type" content="text/html; charset="utf-8"/>