Fix replies to messages with non-ASCII characters

This commit is contained in:
Bohdan Horbeshko 2023-08-08 00:54:24 -04:00
parent 9377d7a155
commit 64515e2c66
3 changed files with 8 additions and 3 deletions

View file

@ -2,7 +2,7 @@
COMMIT := $(shell git rev-parse --short HEAD)
TD_COMMIT := "8517026415e75a8eec567774072cbbbbb52376c1"
VERSION := "v1.7.5"
VERSION := "v1.7.6"
MAKEOPTS := "-j4"
all:

View file

@ -15,7 +15,7 @@ import (
goxmpp "gosrc.io/xmpp"
)
var version string = "1.7.5"
var version string = "1.7.6"
var commit string
var sm *goxmpp.StreamManager

View file

@ -149,7 +149,12 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) {
"end": body.End,
}).Warn(errors.Wrap(err, "Failed to parse fallback end!"))
}
text = text[:start] + text[end:]
fullRunes := []rune(text)
cutRunes := make([]rune, 0, len(text)-int(end-start))
cutRunes = append(cutRunes, fullRunes[:start]...)
cutRunes = append(cutRunes, fullRunes[end:]...)
text = string(cutRunes)
}
}
var replaceId int64