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

ColdFusion IPv6 to 128-bit unsigned int
What type of Request Data can be Retrieved from ColdFusion Headers?
need to start the cfoutput from row 2
Downloading file though Box API 2.0 giving 200 as response instead of 302 found
ColdFusion regex to properly format an ipv6 address
How to get the information about the page that call .cfc page and function? ColdFusion9
Coldfusion 11 and Lucee Server on Same Machine
cffunction/cfargument pass unsigned int32
How to read populated columns only with CFSpreadsheet
How can I define the number of rows on cfspreadsheet object?
Using cfx_http5 tag to replace cfhttp code
How to deal with variable in recordcount
QoQ: LIKE comparison not returning all records expected
ColdFusion recaptcha form and server validation
Keeping the values of form on page
What is the large a.cfm file located within the CFIDE images folder

Categories

HOME
cordova
web
logic
loadrunner
inno-setup
statistics
cordova-plugins
glusterfs
fluent-assertions
directive
sourceforge
astyle
prestashop-1.6
recurly
odbc
nlog
ssrs-2016
xmlstarlet
uiinterfaceorientation
btrfs
filepicker.io
hal
protobuf-c
c#-to-f#
neoscms
ecore
pam
crawler4j
tridion
pi
hana-cloud-platform
redhat-bpm
digestive-functors
c#-6.0
webos
gemfile
pbs
xunit.net
lsof
sqlitestudio
subtitle
invoke
wso2dss
miva
angularjs-service
synopsys-vcs
asana-connect
siteminder
orphan
smf
nested-forms
classname
spawn-fcgi
tvml
angular-component-router
msbuildcommunitytasks
angularjs-ng-options
protection
elasticsearch-marvel
custom-validators
microsoft.mshtml
dynamicquery
zenoss
django-1.7
orca
syntactic-sugar
hasp
interlacing
commission-junction
dbase
citrix-access-gateway
graphml
slimv
memory-mapped-files
keymando
clang-complete
nexus-7
mbprogresshud
plcrashreporter
silverlight-embedded
smalldatetime
clean-language
cck
id-generation
comdlg32
google-notebook
task-tracking

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile