https://bugzilla.wikimedia.org/show_bug.cgi?id=66199

            Bug ID: 66199
           Summary: The output of wfMessage( 'i-dont-exist' )->text()
                    should not have its entities html encoded
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Language converter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
       Web browser: ---
   Mobile Platform: ---

wfMessage( 'i<dont>exist' ) has a two possible outputs depending on the format
utilized to output the content, either:

plain: <i&lt;dont&gt;exist>
text/escaped/parse: &lt;i&lt;dont&gt;exist&gt;

Note that i'm not encouraging special characters in i18n keys, merely showing
what the current implementation does.

The method documentation for Message::text() states that it is unescaped
message text. Documentation for Message::plain() states that it is unescaped
untransformed text. Based on the documentation my inference is that text() and
plain() should have the same output, with {{FOO}} messages transformed only in
the text method.

One option for escaping is to escape as close to the output as possible. In an
API response consumed by client-side javascript the strings within the JSON
should be plain text. This plain text is then escaped for output in the
templating layer of the client side javascript. Using this setup mistyping an
i18n key looks like you have not only bad i18n key but also a double-encoding
issue.  Upon further investigation the double-encoding only happens with the
non-existent key.

I'm proposing the output should be:

plain/text: <i<dont>exist>
escaped/parse: &lt;i&lt;dont&gt;exist&gt;

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to