coldfusion


Using ColdFusion to show Chinese Characters from AS/400 server


I am writing a ColdFusion program that uses cfquery to get data from an AS/400 iSeries table and then output that data to a web page. Some times the Data is in Chinese, but it does not output the Chinese characters correctly.
I built the query below for testing,
<cfprocessingdirective pageEncoding="UTF-8" />
<cfquery name="Test" Datasource = "AS400">
select dsc1 from sales where ref = '123456'
</cfquery>
<cfoutput>#test.dsc1#</cfoutput>
The result should be "M5方头螺栓" but I only get "M5". I did another test running just:
<cfset x = "M5方头螺栓"/>
<cfoutput>#x#</cfoutput>
and it displays the Chinese no problem.
Since ColdFusion can display the characters when they are written out in the code, but not when it goes to get the data through SQL, it seems like the issue is with either my ODBC settings or my ColdFusion Server Data Source Settings but I'm not familiar enough with these settings to know what needs to be changed to get this working.
You've already proven that CF can output UTF-8 characters correctly. Have you tried running that query in the DB console or UI? Do you get the correct charaters?
If the characters were stored as VARCHAR and not NVARCHAR, then there's nothing you can do. The data has to have been properly stored in the first place.
If the characters are stored correctly in the DB, try adding <cfprocessingdirective pageEncoding="utf-8"> at the top of the request. CF should be using UTF-8 by defualt, but this will force the correct character set if, for some reason, it isn't.

Related Links

Is there any way to make a page only callable by the ColdFusion admin? [duplicate]
How do I add a dynamic sitemap.xml to a CFWheels application?
How to use cfparam for a structure in CF8?
CFhttp to Scrape Image
Inconsistent 'Cannot find CFML template for custom tag' error
ColdFusion Client vs Session Variables
Error with addstoredproc method in cfscript
ColdFusion structure initializing many properties at a time
coldfusion struct syntax and query data
ColdFusion CFForm Select Box Item Selected
Using wirebox in coldbox how do I create a bean from a model
Is there a way to (per request) set a non-persistent Database Bean in Coldbox
Coldfusion multiserver cluster session replication - arrays in sessionscope
Strange database error in Coldfusion
Building URL Dynamically
Am i at the end of a list ColdFusion

Categories

HOME
docker
videochat
gnuplot
solr
perl
powerbuilder
aws-codepipeline
speech-recognition
q-learning
axis2
mapkit
asp.net-web-api2
inform7
tensorboard
chapel
protege
osticket
directive
windows-authentication
appcelerator-titanium
codecvt
shogun
junit4
prefix
bit-manipulation
probability-theory
boost-python
apl
data-migration
mahapps.metro
rcp
gsutil
gperftools
hashcode
product-key
dexguard
direct3d9
dos
android-optionsmenu
oclazyload
ffi
pywinusb
lsof
angular-chart
preferencefragment
sqlitestudio
cakephp-3.3
matlab-guide
proof-of-correctness
ikvm
graylog
live-connect-sdk
topshelf
google-url-shortener
satellite
voxel
jake
nslog
azure-webjobssdk
visual-c++-2013
news-feed
ilmerge
smf
nested-forms
grape
little-endian
graphic-effects
arrangeoverride
httpful
ios9.3
jseparator
singularitygs
tess-two
fody-propertychanged
zshrc
wordpress-4.5
xlet
bpopup
childviewcontroller
er-diagrams
sapb1
jquery-dynatree
stackato
angularjs-ng-show
dav
django-1.2
statamic
firepad
maskedinput
readelf
iwebkit
dotfuscator
grit
happstack
generic-list
xemacs
launching-application
visualtreehelper
kiln
silverlight-embedded
fql.multiquery
xml-comments
wss-3.0
loose-coupling
live-cd
uint32
visual-programming
pvcs

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile