1

I have populated a select with information from a mysql database. However all characters with accents on them (i.e ç, á, õ, etc.) appear as question-marks within a diamond (see image below).

Diamond question marks

The code is sound it's just these diamonds, how do I make it so the actual letters appear?

<select>
    <option selected disabled>District...</option>
    <?php
        $sql="SELECT dist_name FROM districts;";
        $result=mysqli_query($conn, $sql) or die(mysqli_error());

        while($row = mysqli_fetch_assoc($result)){
            echo'   <option value="'.$row['dist_num'].'">'.$row['dist_name'].'</option> ';
        }
    ?>
</select>

Thank you for your help in advance! :D

PS: The language is Portuguese

1 Answers1

1

To display an HTML page correctly, a web browser must know which character set (character encoding) to use.

This is specified in the tag:

For HTML4: <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">

For HTML5: <meta charset="UTF-8">

Roshan Patil
  • 196
  • 7