Hugo Ahlenius wrote:
> So cfhttp.filecontent contains this string as a string. How do I convert
> this to utf-8? The file actually contains only latin1 characters, so
> that might have been a better solution for the time being (though not
> future-proof).

well in so far as the euro, etc. aren't in iso-8859-1, yes that would be 
a good long-term choice. not to mention the karma points you build up.

> I solved this by cfhttp:ing the file as binary, and then doing a
> ToString(cfhttp.filecontent,"utf-16") conversion -- but it feels like a
> dirty hack. Are there no cf way to cast/encode strings back and forth?

charsetEncode/charsetDecode in 7 though nothing you're doing is "wrong" 
in 6 or 7.

> And if not, are there java things for this?

i suppose you could use java (URL) to grab that file but that's not 
buying you much more control (though having to use accompanying java IO 
stuff like OutputStreamWriter does give you more control over 
input/output encoding). as far as after the fact charset "casting" 
there's core java Charset (though mostly reflected in cf functions) or 
icu4j UCharacter (mainly metadata but has some conversion stuff as well).

you might find this useful reading:
http://mxblogspace.journurl.com/users/admin/?mode=article&entry=7288

you also might poke that content with something like:
cfhttp.filecontent.getClass() (or getName()) to see what java thinks the 
content is. just for fun.

> PS. Paul H., I have an open i18n issue/thread on the ESRI ArcIMS forums,
> if you are curious/interested.

still getting over the shock of upgrading to 9 (desktop & arcIMS) over 
the weekend (i really didn't appreciate having to manually install 
arcIMS under jrun/cf). i'll try to take a look later.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206758
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to