Contact Us Today!   |   + 1 (301) 424 3903



Simple Unicode Tips

Here are some simple tips that would be helpful while working with Unicode data.

- While registering Microsoft SQL Server Database, please be sure to check "Enable Unicode for data sources configured for non-Latin characters" setting in ColdFusion DSN settings.
MS SQL Server Un'code setting in CF Admin

- If you are using MS SQL Server, use "nvarchar", "nchar" etc. for text fields.

- If you are using MySQL, use "utf8" as main encoding for tables.

    CREATE TABLE unicode_stuff (
    ...
    ) CHARACTER SET utf8;

- Use "cfqueryparam" in SQL queries.
    <cfquery name="getData" datasource="cfdocexamples">
       SELECT    FirstName,
             LastName
       FROM   employees
       WHERE   LastName = <cfqueryparam value="#LastName#" cfsqltype="CF_SQL_VARCHAR">
    </cfquery>

- Use a Unicode capable editor such as Dreamweaver or Eclipse. Do not use Homesite or CFStudio for projects that we need Unicode support.

Adobe TechNote: Unicode issues in HomeSite/HomeSite+ 5.5
http://www.adobe.com/go/tn_19059

- Save your files in "Unicode" and BOM (Byte Order Mark) enabled. This is possible in any text editor such as Notepad or in Dreamweaver. BOM is important for Unicode text that we have direct as static content in our files.
DW Unicode Page

- Use meta tag to have Unicode support.
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

- Try to use standard coding such as XHTML.
<!DOCTYPE html PUBLIC "Çspan style='color: #808080'ÈÇemÈ-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Ç/emÈÇ/spanÈ<html xmlns="http://www.w3.org/1999/xhtml">
...

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner