https://golang.org/ref/spec#String_literals

Here you go.


Le mer. 28 août 2019 à 14:05, Durga Someswararao G <
[email protected]> a écrit :

> Hi Martin,
> Thanks for your help.
>
> From first point as you said is right in my case \\n is as it is
> considering \n as string thanks for this.
>  Second point you mentioned about back-ticks where can I get this
> information? Can you please share any reference links to get more knowledge
> about this.
>
> Thanks.
>
>
> On Wed, Aug 28, 2019 at 4:45 PM Martin Schnabel <[email protected]> wrote:
>
>> 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 <
>> [email protected]
>> > <mailto:[email protected]>> 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
>> >     <[email protected]
>> >     <mailto:[email protected]>> 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
>> >         <[email protected] <mailto:[email protected]>> 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
>> >             [email protected]
>> >             <mailto:golang-nuts%[email protected]>.
>> >             To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/golang-nuts/865188f0-405e-45ee-82b9-7f6d24f1d49f%40googlegroups.com
>> .
>> >
>> >         --
>> >         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 [email protected]
>> >         <mailto:[email protected]>.
>> >         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 [email protected]
>> > <mailto:[email protected]>.
>> > 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
>> >.
>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/2c202a4b-1db1-2247-d374-814f66c81b0c%40mb0.org
>> .
>>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CA%2Ba9DGog4ggBVtiMCqf5cMUzD9wHi-NEzh%2B2rjfm4QPnyv6yqQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/golang-nuts/CA%2Ba9DGog4ggBVtiMCqf5cMUzD9wHi-NEzh%2B2rjfm4QPnyv6yqQ%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CANgi334hAFX1R8f-n0AToUR5d%2Bt5He4zyD_H7wndfVtkJ872mg%40mail.gmail.com.

Reply via email to