Search code examples
phpmysqlphpmyadmincharacterfractions

How to store a fraction as a character in MySQL so it can be outputted within text


I am trying to store the fraction 3/5 (three fifths) as a character in MySQL so that it outputs in php like the symbol ½ within a line of text. I am using phpMyAdmin.

The code for the fraction 3/5 is:

  • Character Name - VULGAR FRACTION 3/5
  • Character - ⅗
  • Entity --
  • Num Entity - ⅗
  • Hex Entity - ⅗

Is there a way to do this.


Solution

  • There is a long answer here that explains what you need. Basically you need to make sure all your tables are using utf-8 encoding. It will take some debugging.