Title: Forms, encoding, mysql question
Last modified: August 18, 2016

---

# Forms, encoding, mysql question

 *  [younghusband](https://wordpress.org/support/users/younghusband/)
 * (@younghusband)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/)
 * I have a question about how WP processes forms. I am trying to build a little
   MySQL database that can be populated by an online form for a side project. It
   is for books. I need to enter titles in 2 languages. Thus I set it up for UTF-
   8 just like my WordPress install. Unfortunately it only seems to render the characters
   properly when I have my browser to to UTF-8 when I type in the data, and also
   UTF-8 when I try to read the output on the webpage. My WordPress install works
   fine with both languages, and no need to switch the encoding in the browser. 
   I am a n00b when it comes to the specifics of charset encoding. Can anyone point
   me to a source on how to do this?

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Thread Starter [younghusband](https://wordpress.org/support/users/younghusband/)
 * (@younghusband)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487040)
 * Nothing?
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487041)
 * I am no coder by any means… but what is the encoding on the page where your online
   form collects the data? If it s NOT utf-8, then what do you expect?
 * EDIT. This one is also a good read: [http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html](http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html)
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487042)
 * Add this to your webpage’s HEAD section:
 * `<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />`
 * (That should all be on one line, no breaks)
 * Alternatively, configure your webserver to send a UTF-8 content type in the http
   headers.
 *  Thread Starter [younghusband](https://wordpress.org/support/users/younghusband/)
 * (@younghusband)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487043)
 * The following is the head of the input page:
 * `<head>
    <title>Media Admin Panel</title> <meta http-equiv="Content-Type" content
   ="text/html; charset=utf-8"> </head>
 *  Thread Starter [younghusband](https://wordpress.org/support/users/younghusband/)
 * (@younghusband)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487044)
 * As for the server, WP is installed on the same server. In fact, the Media DB 
   table I put together is in the same DB as WP. I have no problem typing Japanese
   and English on WP. There must be some code for passing characters that I am not
   putting into my form…
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487045)
 * If you don’t force the encoding, and in Firefox right click and go to “View Page
   Info”, what does the encoding show up as?
 *  Thread Starter [younghusband](https://wordpress.org/support/users/younghusband/)
 * (@younghusband)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487047)
 * I commented out the encoding on all pages (admin, japanese output and english
   output) and then did what you said in Firefox and it told me: ISO-8859-1
 * Something I should mention, this is written in perl, not PHP. I don’t know if
   that has an effect on the outcome. I was hoping it was just encoding.
 * EDIT: Also, looking up the db on phpMyAdmin the MySQL charset is UTF-8 and MySQL
   connection collation is utf8_unicode_ci
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487048)
 * I guess Otto didn’t suggest to comment out the charset metatag, but to look at
   the page without setting your browser to utf-8 and see what is the encoding that
   it gets automatically…
 *  Thread Starter [younghusband](https://wordpress.org/support/users/younghusband/)
 * (@younghusband)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487051)
 * Oh! Okay, well I tried that and got the same thing: ISO-8859-1
 * So the meta tag isn’t forcing the charset to actually change… what to do?
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487055)
 * A few things:
    a) The meta tag needs to be closed. So either change the end to`/
   >` or add a `</meta>` after it. Always close all tags. b) UTF-8 should be capitalized.
   iso-8859-1 should not. c) If you are writing this as a script, just set the Content-
   Type header directly. It should be “text/html; charset=UTF-8”. In PHP, I would
   do this with: `header("Content-Type: text/html; charset=UTF-8");` before any 
   output was made, so probably right at the top of the script. I do not know what
   the Perl equivalent of this would be.
 *  Thread Starter [younghusband](https://wordpress.org/support/users/younghusband/)
 * (@younghusband)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487059)
 * Well, I closed the tag but in FF the encoding still comes up as ISO-8859-1. (
   in the META section is states UTF-8…)
 * Still no go though…
 * I found out how to set the charset in perl:
 * `print "Content-Type: text/html; charset=utf-8nn";`
 * I will have to consult a perl pro to get this into the script and see if that
   works.
 * Thanks for your help Otto and Moshu.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Forms, encoding, mysql question’ is closed to new replies.

## Tags

 * [encoding](https://wordpress.org/support/topic-tag/encoding/)
 * [forms](https://wordpress.org/support/topic-tag/forms/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 11 replies
 * 3 participants
 * Last reply from: [younghusband](https://wordpress.org/support/users/younghusband/)
 * Last activity: [19 years, 5 months ago](https://wordpress.org/support/topic/forms-encoding-mysql-question/#post-487059)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
