Somewhere in your code producing the text you seem to escape the
the escape sequence for the newline character.
"\n" is a string with the escape sequence for the newline character '\n'
"\\n" is a string with escaped slash and a lowercase n '\\' 'n'
Again, without seeing the code we can only guess. Here is another one:
Go has raw string literals using back-ticks `like this` those literals
do not use escape sequences (`\n` == "\\n" && `\\` == "\\\\"). Could it
be, that you accidentally used those raw string literals in the producer
code with the newline escape sequence that is not supported?
On 28.08.19 12:32, Durga Someswararao G wrote:
> Hi,
>
> Manually I tried but here my concern is shall I get the reason, Why that
> was happening like that?
> I am trying to debug strings.Replace is not working.
>
> Thanks.
>
> On Wed, Aug 28, 2019 at 3:52 PM Michel Levieux <
m.le...@capitaldata.fr
> <mailto:
m.le...@capitaldata.fr>> wrote:
>
> Hi,
>
> Isn't it that from the other side, you escape the string, or call a
> method that does it before sending it via tcp? That would explain
> that all the "\n" become "\\n".
>
> Le mer. 28 août 2019 à 12:17, Durga Someswararao G
> <
durgasomes...@gmail.com
> <mailto:
durgasomes...@gmail.com>> a écrit :
>
> Hi Tamás,
>
> But even in other side also I am using golang to convert string
> into bytes. Using tcp connection with net package I am getting
> data from other process.
>
> FYI
> When I try to replace string with \\n it was working fine.
>
> Like below:
> processoutput = strings.Replace("<CustomTag>String 1\n String
> 2</CustomTag>","\\n","'@_@_@'",-1)
>
> On Wed, Aug 28, 2019 at 3:26 PM Tamás Gulácsi
> <
tgula...@gmail.com <mailto:
tgula...@gmail.com>> wrote:
>
> That means that other process speaks some other encoding,
> not utf-8, which the strings package waits.
> Use
golang.org/x/text/encoding
> <
http://golang.org/x/text/encoding> to convert to utf-8.
>
> --
> You received this message because you are subscribed to the
> Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails
> from it, send an email to
>
golang-nuts...@googlegroups.com
> <mailto:
golang-nuts%2Bunsu...@googlegroups.com>.
> <mailto:
golang-nuts...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/golang-nuts/CA%2Ba9DGr83pA%2Bvrkg-bYkOs-qjsqxkOgEjoGTmigtJsr0hO287w%40mail.gmail.com
> <
https://groups.google.com/d/msgid/golang-nuts/CA%2Ba9DGr83pA%2Bvrkg-bYkOs-qjsqxkOgEjoGTmigtJsr0hO287w%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
golang-nuts...@googlegroups.com
> <mailto:
golang-nuts...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/golang-nuts/CA%2Ba9DGrM47a%3Dj6Zbk1caY46FYUG7fXC2J0z0QvoJtSp69b6NCQ%40mail.gmail.com
> <
https://groups.google.com/d/msgid/golang-nuts/CA%2Ba9DGrM47a%3Dj6Zbk1caY46FYUG7fXC2J0z0QvoJtSp69b6NCQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.