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

Inheritance not working with cfinclude
ColdFusion adding a space to strings when returned from function but not when assigned to variable [duplicate]
New session on every request
Issue with cfdocument page break
coldfusion cfc methods performance when calling by reference vs by object name
In Coldfusion, some Arabic characters not displaying in PDF
ColdFusion.Ajax.Submit cannot find form id
Returning a Date object in JSON using a specific format
How RedShift Sessions are handled from a Server Connection for TEMP tables
CFSpreadsheet Read - Wrong decimal symbol after updating to Windows 10
CF Blank White Screen No Errors
Var scoping issue possibly?
Create a loop to get 6 items from fullcalendar
Variable values changing between requests in ColdFusion
Strip html to end up with linebreak-delimited list
ColdFusion - How to prevent direct access of webpage

Categories

HOME
web
veins
angular-material2
amazon-redshift
castle-windsor
imageview
visual-studio-mac
q-learning
login
reactor-netty
mips32
cordova-plugins
crc
uinavigationcontroller
pivot-table
spark-dataframe
datepicker
row-number
emu8086
systemml
recurly
stackdriver
cider
packet-capture
boto
silex
bug-tracking
virtuoso
scons
akka-stream
autoload
jointjs
eureka-forms
geckofx
inversifyjs
vim-syntax-highlighting
hp-quality-center
sublimerepl
gearman
uisegmentedcontrol
pam
sequences
toml
winrt-xaml
webos
maximo-anywhere
ektron
oclazyload
gold-parser
lighttable
cics
burn
xc8
angular-chart
rufus-scheduler
xquery-sql
terminal-emulator
nosuchelementexception
fixed
collaborative-filtering
c#-to-vb.net
jquery-tags-input
itil
htsql
git-stash
eclipse-indigo
onbeforeunload
highcharts-ng
sos
pragma
r1soft
ooyala
pagerslidingtabstrip
heapsort
argo
distinct-on
nameerror
delphi-5
unexpectendoffile
sql-server-2008-express
nstablecolumn
proto
elasticsearch-marvel
android-bundle
pixman
lastaccesstime
maven-site-plugin
seeding
grunt-contrib-cssmin
jquery-dynatree
iec61131-3
navigationbar
wtl
django-1.7
orca
teamsite
sine-wave
triples
impactjs
mathgl
teamcity-7.1
kendo-validator
texmacs
topcoat
inter-process-communicat
toplink
craftyjs
fubumvc
rs485
set-theory
emacs-dirtree
lytebox
strtotime
camping
keymando
nexus-7
viewstack
mobile-phones
in-app
continuations
cloning
eda
fql.multiquery
dft
executequery
uint32
itsm
xla

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App