|
[
Permalink
| « Hide
]
Nicolas Martignoni added a comment - 19/Mar/08 07:17 PM
After more inspection, it turns out that the only entities that are parsed are in the form ddd;, where the d's are digits. The & is not parsed, but printed instead.
the p() and s() are not designed to print html with tags & etc., it is for plaintext and form values mostly, looking at this now...
fixed the members.php - uses echo() now
please reopen if there are more similar problems, thanks for the report! Thanks for the quick fix. Verified. I don't close this as I'm pretty sure that there are other instances of this issue.
NB Should the developer docs be updated with this info about p() and s()? Yes, please fix the docs if you can
Docs updated here: http://docs.moodle.org/en/Development:Coding#General_rules
Reopening as s() is used in admin/uploaduser.php to print status messages, see e.g. function track() of class uu_progress_tracker.
I think if we are being strict, in XHTML, in browsers that treat the content as XML and which do not parse the DTD, then will not work, so it is always safer to use numeric entities like . Or since all lang files are UTF-8 anyway, just put the characters in them directly.
Anyway, I suppose the issue is: what do lang strings contain? Is it plain text, or HTML source? I guess it is HTML source, in which case the rule should be numeric entities only (plus the three that are included in XML: <, >, &, ', "). However, when lang strings are output as attribute values in the HTML, it is essential that ' and " are output as ' and ", and that is certainly not the case in any language pack I have seen. Therefore the strings need to be fed through a function to escape them, and s() and p() are Moodle's standard function for doing this, and we seem to have come full circle. Please someone explain to me! Hi Tim!
I too would prefer UTF-8 chars directly in lang files, but for some reason (sprintf lacking support of multibyte chars) the UTF-8 non-breaking space chars breaks lang strings. See Otherwise, we should instruct lang pack maintainers, including myself The numeric entities are too not parsed by p() and s().
Now that
Adding David as a watcher, re chat discussion about entities.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||