diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-08-08 07:54:24 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-08-08 07:54:24 +0300 |
commit | 64515e2c666067953e3a9680b4f0db84f3838498 (patch) | |
tree | ca8c841a2ca45458a03b3f966586c3b44c8ee964 /xmpp | |
parent | 9377d7a15538a6c0af97937806ecd55eb112beb3 (diff) |
Fix replies to messages with non-ASCII charactersv1.7.6
Diffstat (limited to 'xmpp')
-rw-r--r-- | xmpp/handlers.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go index e85dfc9..36f9cf9 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -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 |