Skip to content

Commit

Permalink
[ISSUE #2251]Reliance on default encoding [IOTinyUtilsTest] (#2272)
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebZYC authored Nov 28, 2022
1 parent 4bb3d4d commit eae65ad
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.List;

Expand Down Expand Up @@ -66,7 +67,7 @@ public void testToString() throws IOException {
File temp = null;
try {
temp = File.createTempFile("temp", ".txt");
BufferedWriter bw = new BufferedWriter(new FileWriter(temp));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(temp), StandardCharsets.UTF_8));
bw.write("test toString");
bw.close();
String res = IOTinyUtils.toString(Files.newInputStream(temp.toPath()), EventMeshConstants.DEFAULT_CHARSET);
Expand Down

0 comments on commit eae65ad

Please sign in to comment.