I'm getting text strings like "Cisco device <<HW_VER:1.0; SW_VER: 2.x>>", 
then they are converted do JSON, and at some point one of task is to log 
them again as a string by calling string(json_obj).
Here is problem since in logs hey all appear as  \u003c\u003 instead of << 
or >>.


W dniu poniedziałek, 3 października 2016 13:07:32 UTC+2 użytkownik 
Konstantin Khomoutov napisał:
>
> On Mon, 3 Oct 2016 03:35:15 -0700 (PDT) 
> Marcin Jurczuk <[email protected] <javascript:>> wrote: 
>
> > > > I hit some issue with son.Marshal string parsing and I don't know 
> > > > is it package error or "this is not a bug - it's a feature". 
> > > > 
> > > > Here is code that doesn't work like expected: 
> > > > https://play.golang.org/p/vAOhLCtoSh 
> > > > 
> > > > 
> > > > Why I'm getting \u003c\u003 instead of << when printing printing 
> > > > out 
> > > json ?? 
> > > 
> > > 
> > > 
> http://stackoverflow.com/questions/21592283/character-in-json-data-is-serialized-to-u003c
>  
> > > 
> > In the mean time I've founded that it has to do with HTML injections. 
> > Question remains how in go get rid/disable this protection ? 
> > I'm getting this data from SNMP communication and I have to parse 
> > them, display and store. 
> > 
> > I didn't found in json library any method to handle such "protection". 
> > Does it mean I have to write some regex parser and call it every time 
> > I'm getting data from JSON  to bypass this ? 
>
> Any compatible JSON decoder is supposed to convert these \uNNNN escape 
> sequences into proper UTF-8 characters when decoding them. 
> So what is your specific problem? 
>
> I mean, you first mentioned json.Marshal and then you tell us you *get* 
> some JSON streams from an SNMP appliance which suggests you're dealing 
> with decoding (unmarshaling).  Hence I fail to comprehend the concrete 
> problem you have. 
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to