Skip to content

Commit ad8c395

Browse files
committed
Fixed bug where text files using CRLF line endings would fail to parse
1 parent cd58378 commit ad8c395

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Sources/TextFileKit/StringTableRepresentable.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ extension StringTableRepresentable {
5050
usedLossyConversion: &usedLossyConversion
5151
),
5252
rawValue != 0,
53-
let rawText = nsString as? String
53+
var rawText = nsString as? String
5454
else {
5555
throw TextFile.ParserError.unrecognizedTextEncoding
5656
}
5757
let /*encoding*/ _ = String.Encoding(rawValue: rawValue) // TODO: not used
5858

59+
rawText = rawText.replacingOccurrences(of: "\r\n", with: "\n") // TODO: hacky line-ending conversion
60+
5961
self.init(rawText: rawText)
6062
}
6163
}

0 commit comments

Comments
 (0)