This is an extension of my question [here](https://stackoverflow.com/questions/19039948/why-is-xmlparser-converting-my-character-hex-code-string-to-unicode).

In a simple test to gather more information for the question I linked to I tried to insert an ampersand character into my database through the phpMyAdmin interface...

```
INSERT INTO `my_db`.`some_table` (`id`, `version`, `value`) VALUES (NULL, '0', '&');

```

... but what gets inserted is the HTML equivalent `&amp;`.

My database collation is `utf8_bin`, the table I'm inserting into is `utf8_general_ci`, and the field I'm attempting to insert the ampersand into is of type `varchar`.

What must I do to insert the raw ampersand character `&` into my MySQL database?

**Update:**

I don't know what the problem with phpMyAdmin is, but I think I found the problem with my application. It seems that Hibernate just wasn't using the correct character set for the connection. I already had a custom MySQL dialect specified so I just overrode the `getTableTypeString` method as seen below and my application now inserts values into MySQL properly:

```
class CustomMySQL5InnoDBDialect extends MySQL5InnoDBDialect {   
    @Override
    public String getTableTypeString() {
        return " ENGINE=InnoDB DEFAULT CHARSET=utf8"
    }
}

```