Inserting arabic/persian characters to mysql

New Here ,
Sep 16, 2014 Sep 16, 2014

Copy link to clipboard

Copied

I insert my data into mysql db with this code:

<cfprocessingdirective pageEncoding="utf-8"> 
<cfset setEncoding("URL", "utf-8")>
<cfset setEncoding("Form", "utf-8")>
<cfcontent type="text/html; charset=utf-8">

<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>

<cfparam name="postTextBox" default="" type="String">

<cfoutput>
  <form action="index.cfm" method="POST" name="form">
  <input name="postTextBox" type="text"/>
  <input name="" type="submit" value="Submit" />
  </form>
</cfoutput>

<cfquery name="myQuery" datasource="hello">
  insert into ad (name) 
  values(N<cfqueryparam value=#postTextBox# cfsqltype="cf_sql_varchar">)
</cfquery>

</body>
</html>

The problem is when I insert arabic or persian characters that's store in database something like "?????" but there is no problem with english characters. I use ColdFusion 10 and mysql.

My database collation is utf-8 and my column is utf-8 too.

What's wrong on my project?

Regards

Views

422

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation