[Developers] html entity encoding

Christopher R. Maden crism at metaweb.com
Sat May 3 01:20:07 UTC 2008


Nick Thompson wrote:
> i don't think the default language support in mql is
> complete yet.  it's not so much choosing something other
> than /lang/en that's the problem - but for practical purposes
> what you want is "some preferred language, with fallback to /lang/en".
> it's that fallback part that's tricky.
> i think it's safe to say that it will be set with the "lang" parameter
> in the envelope once it's ready though.

It works.

{
   "lang" : "/lang/fr",
   "query" : {
     "id" : "/en/united_states",
     "name" : null
   }
}

Nitpicking (nixpicking?):

 > hmm, i think &dquo; should probably be used as well, thanks for
 > the reality check.

Uh... " please!  If anything.  But really not necessary; JSON can 
escape " with \", and " is only needed inside HTML attributes *as 
markup*, and so will already have been escaped as ".

HTML string:
<em>foo</em>
Unescaped MQL:
"str":"<em>foo</em>"
Escaped MQL:
"str":&lt;em>foo&lt;/em>"

HTML string:
<em title="bar">foo</em>
Unescaped MQL:
"str":"<em title=\"bar\">foo</em>"
Escaped MQL:
"str":"&lt;em title=\"bar\">foo&lt;/em>"

HTML string:
<em title="bar &quot;baz&quot;">foo</em>
Unescaped MQL:
"str":"<em title=\"bar &quot;baz&quot;\">foo</em>"
Escaped MQL:
"str":"&lt;em title=\"bar &amp;quot;baz&amp;quot;\">foo&lt;/em>"

There is no need for MQL escaping to provide &quot;.

~Chris
-- 
Christopher R. Maden
Data Architect
Metaweb Technologies, Inc.
<URL: http://www.metaweb.com/ >


More information about the Developers mailing list