You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2021/04/21 14:10:25 UTC

[plc4x] 02/04: plc4go: fixed bug where strings could overwrite their encoding in json

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit c32d2024733d96e51075bc351bd55194aabf0340
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Apr 21 13:38:02 2021 +0200

    plc4go: fixed bug where strings could overwrite their encoding in json
---
 plc4go/internal/plc4go/spi/utils/WriteBufferJsonBased.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4go/internal/plc4go/spi/utils/WriteBufferJsonBased.go b/plc4go/internal/plc4go/spi/utils/WriteBufferJsonBased.go
index f902937..c463037 100644
--- a/plc4go/internal/plc4go/spi/utils/WriteBufferJsonBased.go
+++ b/plc4go/internal/plc4go/spi/utils/WriteBufferJsonBased.go
@@ -150,7 +150,7 @@ func (j *jsonWriteBuffer) WriteBigFloat(logicalName string, bitLength uint8, val
 
 func (j *jsonWriteBuffer) WriteString(logicalName string, bitLength uint8, encoding string, value string, writerArgs ...WithWriterArgs) error {
 	attr := j.generateAttr(logicalName, rwStringKey, bitLength, writerArgs...)
-	attr[fmt.Sprintf("__plc4x_%s", rwEncodingKey)] = encoding
+	attr[fmt.Sprintf("%s__plc4x_%s", logicalName, rwEncodingKey)] = encoding
 	return j.encodeNode(logicalName, value, attr)
 }