Skip to content

Commit 5b71d0c

Browse files
Fix encoding with Swift >6
1 parent fe0eb5e commit 5b71d0c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/SwiftAstGenLib/SyntaxParser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct SyntaxParser {
5252

5353
static func encode(_ s: String) -> String {
5454
let data = s.data(using: .ascii, allowLossyConversion: true)!
55-
return String(data: data, encoding: .utf8)!
55+
return String(decoding: data, as: UTF8.self).replacingOccurrences(of: "\u{FFFD}", with: "?")
5656
}
5757

5858
static func parse(

0 commit comments

Comments
 (0)