Reputation: 1813
i have a csv file that i save it with utf-8 encoding like below: reference
FileOutputStream fileOut =fileOut = new FileOutputStream(file, true);
/*utf-8 setting*/
fileOut.write(0xef);
fileOut.write(0xbb);
fileOut.write(0xbf);
/*append another string*/
PrintWriter printWriter = new PrintWriter(fileOut);
printWriter.write(...);
i write string to file and it work correctly with UTF-8
encodeing.
my question is :
cp1256
?UPDATE: assume that i save huge string data that create in pagination and i can not store this size of data in one time.
thanks
Upvotes: 0
Views: 414
Reputation: 1552
Why you don't use the FileUtils from Apache Commons? This will make your life much easier. ;-)
And, If you want to covert the content, have a look here: Encoding conversion in java
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
Upvotes: 2