Re: Values with angle brackets

On 08/17/2012 11:44 AM, Stéphane Corlosquet wrote:
>
>
> On Fri, Jul 20, 2012 at 4:15 AM, nil <nil.niklas@gmail.com 
> <mailto:nil.niklas@gmail.com>> wrote:
>
>     Hi,
>
>     I'm wondering why the playground omits values between < and > in
>     the output.
>     My example input:
>     {
>       "@context": {
>         "message-id":
>     "http://www.semanticdesktop.org/ontologies/nmo#messageId"
>       },
>       "message-id":
>     "<CAERg+cg3y+bKtk9KE5UMmK15+1+U191oUgVZaT=ifhB7YqaMAQ@mail.gmail.com
>     <mailto:ifhB7YqaMAQ@mail.gmail.com>>"
>     }
>
>     The output (in Compacted form):
>
>     {
>       "http://www.semanticdesktop.org/ontologies/nmo#messageId": ""
>     }
>
>     If I put text before / after the brackets, it becomes part of the
>     output. Do I need to escape the brackets? If so, why is that and where
>     is it documented?
>
>
> I can still reproduce this in the playground. It might be that the 
> angle bracket needs to be escaped? using &lt; works. Not sure if the 
> behavior above is a bug in JSON-LD or in the playground. Seems like 
> the round tripping isn't working: the normalized output has the 
> expected value, but the compacted and expanded outputs don't. Can 
> someone confirm what's going on?
>
> Steph.

Unfortunately no one has had the time to update the playground to use 
something like codemirror (http://codemirror.net) yet. This would fix 
the issue (and several others); the bug isn't in JSON-LD, it is in the 
HTML on the playground. If you inspect the HTML elements for the compact 
output you'll see that it is interpreting what is inside the angled 
brackets as an HTML element because the output is not HTML-escaped.

-- 
Dave Longley
CTO
Digital Bazaar, Inc.
http://digitalbazaar.com

Received on Friday, 17 August 2012 15:59:59 UTC