CRUD for International Strings
I'm obviously not the expert at this, but I needed to allow editing of double byte characters and the like in CF. Here was what worked for me . . .
I was using Microsoft SQL server and in the end the only two things I needed to do were:
- Check the "Enable High ASCII characters and Unicode for data sources configured for non-Latin characters" option in the DSN
- Prefix multi-byte characters with an N on insert/update. E.g. INSERT INTO table (Text) values(N'#form.text#') or UPDATE table SET Text = N'#form.text#'. From what I understand this is NOT required for MySQL.
As interesting were the things I did, then undid and my app still *appeared* to work. Can't yet prove whether they are required or not:
- Set encoding for form and URL scopes in application.cfc: SetEncoding("form", "utf-8"); and SetEncoding("url", "utf-8");. Appears to me that utf-8 is default CF encoding so I'm not sure these are required.
- Add metadata in HTML head tag: . Again, worked without, but this seems like at the very least a good thing to do, so I put it back in.
Got to do a lot more reading on this.
Anyone else got any tips/experiences to share on this or i18n in general?
Update: More on the "enable" checkbox for the DSN.



no, the "N" unicode hint won't work w/mysql. it's a sql server thing.
if you haven't already read the g11n chapter in ben's advanced cf book. pay attention to those boring tables, core java's locale support will bite your ankles off eventually. hang around the java i18n forums, they have been at this game a lot longer than any of us cf folks).
My understanding is that the DSN checkbox and prefixing is if you need to support multi byte and your db column types are already set. Or you don't want the extra space taken that is associated with nvarchar and the like.
Actually, not true. You do need to use nvarchar, ntext and the like, but you ALSO have to add the "N" to your inserts/updates. I'm not SURE if you have to check the box as I didn't try to get rid of that, but I know that without the N (using MSSQL) it didn't work.
http://www.sustainablegis.com/blog/cfg11n/index.cf...
Curiouser and curiouser!
http://dev.besavvy.com/hi.cfm
MySQL is its own pain. Some drivers need the connection string while others for some reason do not.
no, you don't need to use (and i'm not sure you even could) the "N" unicode hint for cfqueryparam data BUT you do have to turn on the unicode option for that DSN for it to work consistently. folks using ray's blog i think will testify to the good practice of turning on this option.
one of the macromedia/adobe cf folks posted a good blog entry on this but i can't for the life of me wrinkle it out of google or mxna.