Skip to content

Commit

Permalink
[ISSUE #2251]Reliance on default encoding [IOTinyUtilsTest]
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebZYC committed Nov 27, 2022
1 parent c6fb147 commit d4cec31
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 d4cec31

Please sign in to comment.