Solved

Special Character endcoding for mysql, coldfusion

Posted on 2013-11-03
2
376 Views
Last Modified: 2013-12-13
Hello,

I'm having a issue with inputting utf-8 characters into the mySQL db. For example if I setup a form ...

    <cfif isDefined("form.submit")>
        <cfquery datasource="#request.dsn#" username="#request.dsnUsername#" password="#request.dsnPassword#">
        INSERT INTO search
        (term)
        VALUE ('#form.search_terms#')
        </cfquery>
    </cfif>

    <form method="post" id="add_form" action="test.cfm" class="form-inline" accept-charset="ISO-8859-1">
        <input name="search_terms" type="input">
        <input name="submit" type="submit">
    </form>


and I enter Japanese characters, I get &#12486;&#12452; entered into the db column which is set at utf-8. I would like to have  Japanese characters as the entry. If I manually enter it in using Navicat it enters just fine that way and displays them without them encoded.

Thanks for any help,
0
Comment
Question by:brihol44
2 Comments
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 125 total points
ID: 39620974
If you want UTF-8, why do you have accept-charset="ISO-8859-1" in your form tag?
0
 

Accepted Solution

by:
jessemtcarlton earned 125 total points
ID: 39699363
You will also need to save your .cfm page as UTF-8 and set the encoding in your HTML declaration to UTF-8: <meta charset="utf-8">.  basically you have to tell the browser and your web server to use UTF-8 or there can be encoding mismatches.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Creating and Managing Databases with phpMyAdmin in cPanel.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now