Bug 60421

Summary: concat task: encoding problem with in-line string
Product: Ant Reporter: Simon Sch. <sw.sch>
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: major    
Priority: P2    
Version: 1.9.7   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Simon Sch. 2016-11-26 09:36:54 UTC
Concat task with in-line string may fail, e.g.:

<property name="fileContent" value="&#x00c4;&#x00d6;&#x00dc; &#x00e4;&#x00f6;&#x00fc; &#x00df;"/>
<concat destfile="output-wrong.txt" outputencoding="iso-8859-15">${fileContent}</concat>

The encoding of concat task (default: null) will not forwarded to embedded StringResource (default encoding: UTF-8; formerly: null). It only works when encoding attributes of Concat task and StringResource matches.

Workaround:

<property name="fileContent" value="&#x00c4;&#x00d6;&#x00dc; &#x00e4;&#x00f6;&#x00fc; &#x00df;"/>
<concat destfile="output-fixed.txt" encoding="utf8" outputencoding="iso-8859-15">
    <string encoding="utf8">${fileContent}</string>
</concat>

-> use explizit StringResource and define matching encoding values for <concat> and <string>.