问题
I have used to do create XML using "Transform Message" Node in Mule ESB.
%dw 1.0 %output application/xml
item: { name: payload."profile_name", id: payload."profile_Id" }
This shown a preview of output xml as
<?xml version='1.0' encoding='windows-1252'?>
<item>
<name>
<profile_name>????</profile_name>
</name>
<id>
<profile_Id>1</profile_Id>
</id>
</item>
This resulted encoding as 'windows-1252' how can i change encoding as 'UTF-8' in my outpout xml ?
回答1:
Go to your Anypoint Studio folder.
Edit AnypointStudio.ini
Add: -Dfile.encoding=UTF-8
Restart
回答2:
Easy, define encoding in the output line:
%dw 1.0
%output application/xml encoding="utf-8"
---
name: payload.name?
the result:
<?xml version='1.0' encoding='utf-8'?>
<name>false</name>
来源:https://stackoverflow.com/questions/34261145/output-encoding-issue-in-mule-esb