Why does the usermeta table contain html entities?

As a plugin developer, I have been storing special characters like ampersand as is in MySQL tables, then converting them to html entities after retrieving them for display.

Now I discover that (for example) wp_insert_user() converts them to entities before storing them in the database.

Have I been doing this the wrong way round? Should I convert before storing and then not convert when retrieving?

Has Wordpress Core adopted any convention for this? What do other plugin developers do?

Topic htmlspecialchars-decode user-meta core Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.