> Hello,
> i've build a script for this Problem.
> But perhaps there is a better way for this problem?

Hi Carsten, sorry I didn't respond to this sooner, I was kind of
expecting that someone who does that kind of work more often than I do
would respond. There are a couple of native functions in ColdFusion 7+
for doing this. CharsetDecode and CharsetEncode which will probably be a
bit faster than the loop. It will certainly be fewer keystrokes.

Information about the CharsetDecode function can be found on the Adobe
livedocs site here: 
http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_c-d_02.html#4990140

So I would expect (but haven't tested) that converting from UTF-8 to
UCS2 would look like this: 

<cfset string = CharsetEncode(CharsetDecode(string,"UTF-8"),"UCS-2") />

*however*

There's a good chance that your string isn't in UTF-8 until the very
last second before it's returned to the http user agent (browser, etc)
because ColdFusion stores strings internally in UCS-2. So if all the
content you're delivering in the current request needs to be in UCS-2
then the above conversion may not work the way you expect and it may be
easier anyway to use the cfprocessingdirective tag, like this: 

<cfprocessingdirective pageencoding="UCS-2">
  <cfoutput>
    <tag>#content#</tag>
  </cfoutput>
</cfprocessingdirective>

More information about cfprocessingdirective can be found again in the
Adobe livedocs here: 
http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_p-q_13.html#2962107

hth,
ike

-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
     ph: 503.236.3691

http://onTap.riaforge.org



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295529
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to