diff --git a/Sources/apk/Index/ApkIndexUpdate.swift b/Sources/apk/Index/ApkIndexUpdate.swift index 77a006d..3593833 100644 --- a/Sources/apk/Index/ApkIndexUpdate.swift +++ b/Sources/apk/Index/ApkIndexUpdate.swift @@ -103,9 +103,8 @@ public struct ApkIndexUpdater { print("Index time: \((ContinuousClock.now - indexStart).formatted(durFormat))") } - let reader = TextInputStream(binaryStream: MemoryInputStream(buffer: apkIndexFile)) return try ApkIndex(raw: - try ApkRawIndex(lines: reader.lines)) + try ApkRawIndex(lines: TextInputStream(binaryStream: MemoryInputStream(buffer: apkIndexFile)).lines)) } } diff --git a/Sources/apk/Utility/TextInputStream.swift b/Sources/apk/Utility/TextInputStream.swift index 8d83a11..0389542 100644 --- a/Sources/apk/Utility/TextInputStream.swift +++ b/Sources/apk/Utility/TextInputStream.swift @@ -74,7 +74,7 @@ struct TextInputStream where InStream.Element == UInt8 { if _fastPath(!self._bytes.isEmpty) { // Convert and return line - return String(bytes: self._bytes, encoding: .utf8) + return String(decoding: self._bytes, as: UTF8.self) } else { if _fastPath(!self._eof) { // Don't bother decoding empty lines and just return an empty string