From 824da7065cc03003e7ddad89ba8d7b4750ae90ff Mon Sep 17 00:00:00 2001 From: Alex Brown Date: Wed, 9 Oct 2024 10:18:37 +0100 Subject: [PATCH] Read file lines in the system default charset. * Ensure that Files.lines(Path) reads filesystem files in the charset of the underlying operating system and not UTF-8. Signed-off-by: Alex Brown --- .../instrumentation/resources/ContainerResource.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instrumentation/resources/library/src/main/java/io/opentelemetry/instrumentation/resources/ContainerResource.java b/instrumentation/resources/library/src/main/java/io/opentelemetry/instrumentation/resources/ContainerResource.java index db46fbb138cb..f323e99b253a 100644 --- a/instrumentation/resources/library/src/main/java/io/opentelemetry/instrumentation/resources/ContainerResource.java +++ b/instrumentation/resources/library/src/main/java/io/opentelemetry/instrumentation/resources/ContainerResource.java @@ -10,6 +10,7 @@ import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.resources.Resource; import java.io.IOException; +import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; @@ -77,7 +78,7 @@ boolean isReadable(Path path) { @MustBeClosed Stream lines(Path path) throws IOException { - return Files.lines(path); + return Files.lines(path, Charset.defaultCharset()); } List lineList(Path path) throws IOException {