Strip U+FFFC from status bodies when posting

Fixes #112
This commit is contained in:
Shadowfacts 2020-09-23 17:20:45 -04:00
parent 0e60e74a8a
commit 733d50b642
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 7 additions and 1 deletions

View File

@ -29,6 +29,12 @@ class Draft: Codable, ObservableObject {
attachments.count > 0 attachments.count > 0
} }
var textForPosting: String {
// when using dictation, iOS sometimes leaves a U+FFFC OBJECT REPLACEMENT CHARACTER behind in the text,
// which we want to strip out before actually posting the status
text.replacingOccurrences(of: "\u{fffc}", with: "")
}
init(accountID: String) { init(accountID: String) {
self.id = UUID() self.id = UUID()
self.lastModified = Date() self.lastModified = Date()

View File

@ -197,7 +197,7 @@ struct ComposeView: View {
self.isPosting = false self.isPosting = false
case let .success(uploadedAttachments): case let .success(uploadedAttachments):
let request = Client.createStatus(text: draft.text, let request = Client.createStatus(text: draft.textForPosting,
contentType: Preferences.shared.statusContentType, contentType: Preferences.shared.statusContentType,
inReplyTo: draft.inReplyToID, inReplyTo: draft.inReplyToID,
media: uploadedAttachments, media: uploadedAttachments,