April 17, 2004

enable unicode dsn option's secret revealed

let me first ask what you think this label means, Enable Unicode for data sources configured for non-Latin characters? if you're like me, you'd probably think it meant that enabling this puppy would force the db driver (sql server in my case) to use Unicode for all text to/from the database. and as it turns out you (and me) would be wrong. now let me backtrack a bit and explain that with sql server you'd normally use unicode hinting--the "N" in N'test'-- to let the db know that a particular chunk of text is actually Unicode. so if you understood Enable Unicode as to actually enable unicode you might be tempted to not use Unicode hinting in your cf sql code. and of course you'd garbage your text data as a result. you might be asking why i'd never picked up this before now (heck blackstone's just around the corner)? because i'm what some folks might call nutso about Unicode, i always go the extra mile in dealing with Unicode--i always use Unicode hinting even when i enabled the Unicode option for a given dsn. so this is an issue i'd never noticed before. so what exactly does Enable Unicode enable? why it controls how the cfqueryparam deals with Unicode text. if you turn it on, cfqueryparam handles Unicode text correctly. turn it off and cfqueryparam turns your Unicode text into a mound of garbage. let me thank figleaf's steve drucker for bringing this issue up in first place (in the forums) and mm's hiroshi okugawa for digging up an mx 6.0 box to test that Enable Unicode has always worked this way. so now you know.

0 Comments:

Post a Comment

<< Home