开发者

Wrong EOL characters when after writing .txt

I use spring-batch 2.1.8 release. Depending if the batch is executed under windows or unix, there's a different EOL character. On unix, the file generated only has CR - on winsows, there are both CRLF.

I configured my writter chunk so that it 开发者_如何学运维encodes the output resource has a windows one, like so :

<property name="encoding" value="cp1252"/>

But no sir. Unix still generates with only CR. It's in the context of a j2ee classic app with spring, controllers and models. So I can write code after the batch is done, before prompting the file to download for the user.

What am I doing wrong?


You could try setting the lineSeparator property of the writer (assuming you are using a FlatFileItemWriter). The javadocs indicate it is using the System property line.separator for the default.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜