Skip to content

Commit

Permalink
Add UTF-8 ByteOrderMark (#2205)
Browse files Browse the repository at this point in the history
Thanks to @r10s
  • Loading branch information
zeitschlag committed Aug 26, 2024
1 parent cb8295b commit 722c758
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion deltachat-ios/Helper/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ struct Utils {
}

public static func share(text: String, parentViewController: UIViewController, sourceItem: UIBarButtonItem) {
guard let data = text.data(using: .unicode) else { return }
guard let textData = text.data(using: .utf8) else { return }

// UTF-8 byte order mark, commonly seen in text files. See [List Of file signatures](https://en.wikipedia.org/wiki/List_of_file_signatures)
var data = Data([0xEF, 0xBB, 0xBF])
data.append(textData)

let tempLogfileURL = FileManager.default.temporaryDirectory.appendingPathComponent("deltachat-log.txt")
try? FileManager.default.removeItem(at: tempLogfileURL)
Expand Down

0 comments on commit 722c758

Please sign in to comment.