Skip to main content
man4toman
Participant
September 16, 2014
Question

Inserting arabic/persian characters to mysql

  • September 16, 2014
  • 0 replies
  • 690 views

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

    This topic has been closed for replies.