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

Amazon Seller Central API Error - Request signature we calculated does not match the signature you provided
“Zombie Requests” CFQUERY tags get stuck and are unkillable
POIUtility.cfc - Cannot read excel files: “Object instantiation exception”
Calling a JavaScript function within a loop
IsSpreadsheetFile function in ColdFusion
How to get query string from an url in coldfusion [duplicate]
How to add the selected ID values to a list after the form is submitted ?
ColdFusion Dropbox - Error in call to API function
Setting up local/network & Coldfusion in ATOM
CFLOCK is extremely slow
Adding security to a CFC file with HTTP_REFERER
Google Natural Language API Error - Bad Request
Create a comma separated list of quoted values
Coldfusion server is too slow + JVM is taking too much memory coldfusion 9
issues with CF query of queries with new patch on coldfusion 11
Could not find the ColdFusion component or interface only rarely

Categories

HOME
machine-learning
java-ee
google-maps-api-3
asynchronous
knn
veins
payment
text
cakephp-3.0
zurb-foundation
wlan
mutex
wayland
google-cloud-endpoints
opentsdb
tensorboard
servo
geometry
docbook
m3u8
cognos-10
pyvmomi
azure-storage-blobs
xlwings
workspace
deprecation-warning
jqxwidgets
filenames
u2
polymer-starter-kit
spring-4
multiple-domains
uisegmentedcontrol
jung
gmail-contextual-gadgets
tablet
kernel-module
rrd4j
smtpclient
angular2-http
nerdtree
grayscale
jenkinsfile
itunes-store
jes
reduce
http-status-code-415
silent-installer
lpc
wamp-protocol
coupling
equation
autocompleteextender
miva
istanbul
machinekey
unite.vim
rate
turtle-rdf
twebbrowser
metamodel
deferred-loading
timedelta
into-outfile
ntfs-3g
phpinfo
dfdl
mongoose-web-server
togglz
johnny-five
8085
opcode
command-line-tool
proto
android-bundle
apache-roller
c1flexgrid
eazfuscator
agsxmpp
compiler-options
image-manipulation
google-plugin-eclipse
navigationbar
desktop-shortcut
facade
webproxy
sine-wave
groff
worklight-studio
offlineapps
ereg
aspnet-regiis.exe
payflowlink
iwebkit
flotr
soaplite
rails-models
windows-explorer
background-music
tomahawk
validationsummary
language-theory
windows-2000
whiteboard

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile