How to use Unicode in Coldfusion - mulitlanguage databases and pages

If you want to create/use multilanguage database records and display them on your pages, you'll have to keep the following points in mind.


When setting up your database, your tables must be able to store the data as unicode. For MSSQL 2000 you'll need to use nchar, nvarchar and ntext instead of char, varchar and text for datatypes of your columns.

When you submit a support ticket for setting up a Coldfusion DSN, please tell us that your DSN needs to support Unicode (UTF-8) so we now we have to set specific settings for that connection


When inserting data into the database, you'll need to specify which part of the data needs to be inserted as unicode values. Here is an example of how it is done with the cfquery tag:
<cfquery datasource="foo">

INSERT INTO table_foo(name, continent, usernotes)
VALUES (N'Michael', N'eu', N'Does some stuff with Coldfusion sometimes')


This example shows an N in front of all the values that needs to be inserted into unicode columns. The columns in this example are setup like this: name = nvarchar, continent = nchar and usernotes = ntext.

Coldfusion pages

To make sure that all the information that is sent is received as unicode, you need to add this code to the top of your Application.cfm
<cfset SetEncoding("form", "utf-8")/>
<cfset SetEncoding("url", "utf-8")/>

Also in the of your page, you need to set the charset to utf-8. Find this line in the head of your page:
<meta http-equiv="Content-Type" content="text/html; charset=your normal encoding" />
and change it to:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
If it doesn't exist, be sure to add it to the tag of your page.

That's about all you need to do to get Coldfusion work with unicode. If you're still having problems getting it to work properly, please submit a support ticket and we can check your DSN to make sure it's enabled for unicode.
  • 5 Users Found This Useful
Was this answer helpful?

Related Articles

How do I create a ColdFusion DSN?

ColdFusion DSN's can now be created through Helm.  To create a ColdFusion DSN log into...

Do you have any Image Resize Components I can use?

Yes, we have several Image Resize components that are free for your use with all hosting...

ColdFusion MX doesn't work on my site.

If ColdFusion does not work on your site, ensure that it is enabled in Helm.  To enable...

How do I create a mapping in ColdFusion MX?

To use a custom mapping, in your application.cfm file, add some code like this: <cfset...

Do you support Flash Remoting?

Yes, Flash Remoting is supported with ColdFusion.  We do not currently support plugins for...