开发者

Wrong EOL characters when after writing .txt

开发者 https://www.devze.com 2023-03-13 16:18 出处:网络
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 CRL

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

精彩评论

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