[ 
https://issues.apache.org/jira/browse/IO-563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16302846#comment-16302846
 ] 

Bruno P. Kinoshita commented on IO-563:
---------------------------------------

Hi [~chenjiangtao],

Thanks for reporting the issue.

I believe what you are seeing is due to the use of FileWriter and some encoding 
issues. The FileWriter 
[javadocs|https://docs.oracle.com/javase/8/docs/api/java/io/FileWriter.html] 
and this [SO 
thread|https://stackoverflow.com/questions/36250571/filewriter-vs-fileoutputstream-in-java/36250626#36250626]
 explain that behaviour.

Here's what I mean, in a pull request: 
https://github.com/chenjiangtao/commons-io-1.3.2-IOUtils-Bug/pull/1

Let me know if that makes sense.

Cheers
Bruno

ps: super thanks for the test code. A perfect example of a well-done 
[SSCCE|http://sscce.org/]. If were not for the sample code, I would probably 
have left the issue to be reviewed by someone else or have a look in a few days 
:-) Thanks!

> IOUtils lose data when write base64 string to file
> --------------------------------------------------
>
>                 Key: IO-563
>                 URL: https://issues.apache.org/jira/browse/IO-563
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Streams/Writers
>    Affects Versions: 1.3.2
>         Environment: Mac OS 10.13.2
> Java version "1.8.0_111"
> scalaVersion := "2.12.4"
> IntelliJ IDEA 2017.2
>            Reporter: chenjiangtao
>              Labels: bug, issue
>
> h1.  commons-io-1.3.2-IOUtils-Bug
> h2. IOUtils write file lose data 
> method: public static void write(String data, Writer output)
> *  result of file: mycat.jpg.b64
> !http://static.tuzhihao.com//1514115829.png?imageMogr2/thumbnail/!100p!
> *  result of file: mystring
> !http://static.tuzhihao.com//1514115874.png?imageMogr2/thumbnail/!100p!
> h2. This bug test in Github
> [https://github.com/chenjiangtao/commons-io-1.3.2-IOUtils-Bug]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to