Browse Source

Fix: message.MessageContent can have special characters which breaks saving to csv. -> Need to utf-8 encode

Signed-off-by: CptSaulGoodman <35928982+MiDoTr@users.noreply.github.com>
pull/280/head
CptSaulGoodman 10 months ago
committed by GitHub
parent
commit
1d98a7613e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      src/pkg/utils/chat_storage.go

5
src/pkg/utils/chat_storage.go

@ -5,6 +5,7 @@ import (
"fmt"
"os"
"sync"
"net/url"
"github.com/aldinokemal/go-whatsapp-web-multidevice/config"
)
@ -79,7 +80,9 @@ func RecordMessage(messageID string, senderJID string, messageContent string) er
}
// Prepare the new record
newRecord := []string{message.MessageID, message.JID, message.MessageContent}
// Fix: message.MessageContent can have special characters which breaks saving to csv. -> Need to utf-8 encode
encodedMessageContent := url.QueryEscape(message.MessageContent)
newRecord := []string{message.MessageID, message.JID, encodedMessageContent}
records = append([][]string{newRecord}, records...) // Prepend new message
// Write all records back to file

Loading…
Cancel
Save