admin管理员组文章数量:1289529
I have an ant build that concatenates my javascript into one file and then presses it. The problem is that Visual Studio's default encoding attaches a BOM to every file. How do I configure ant to strip out BOM's that would otherwise appear in the middle of the resulting concatenated file?
My googl'ing revealed this discussion which is the exact problem I'm having but doesn't provide a solution: /?l=ant-user&m=118598847927096
I have an ant build that concatenates my javascript into one file and then presses it. The problem is that Visual Studio's default encoding attaches a BOM to every file. How do I configure ant to strip out BOM's that would otherwise appear in the middle of the resulting concatenated file?
My googl'ing revealed this discussion which is the exact problem I'm having but doesn't provide a solution: http://marc.info/?l=ant-user&m=118598847927096
Share Improve this question asked Apr 30, 2010 at 6:37 Breck FresenBreck Fresen 2955 silver badges12 bronze badges1 Answer
Reset to default 13The Unicode byte order mark codepoint is U+FEFF. This concatenation mand will strip out all BOM characters when concatenating two files:
<concat encoding="UTF-8" outputencoding="UTF-8" destfile="nobom-concat.txt">
<filelist dir="." files="bom1.txt,bom2.txt" />
<filterchain>
<deletecharacters chars="" />
</filterchain>
</concat>
This form of the concat
mand tells the task to decode the files as UTF-8 character data. I'm assuming UTF-8 as this is usually where Java/BOM issues occur.
In UTF-8, the BOM is encoded as the bytes EF BB BF
. If you needed it to appear at the start of the resultant file, you could use a subsequent concatenation to prefix the output file with a BOM again.
Encoded values for U+FEFF in other UTF encodings are listed here.
本文标签: utf 8Get ant concat to ignore BOM39s39Stack Overflow
版权声明:本文标题:utf 8 - Get ant concat to ignore BOM's'? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741458674a2379903.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论