#14608 closed bug (notabug)
Wrong Textparsing with ® (not ®)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | manipulation | Version: | 1.10.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If you try to write xxx®_xxx in a html context it will be shown as ® (...e®_b...)
Sample: $('#report').html("<div>rpt=sls_fleet_stat_tree&omit_olddata=true&ids=false®_by_month=false&cco_by_month=false</div>")
Change History (5)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
but it is a little bit difficult:
$('#report').html('® & &euro < > &hearts © &trade £')
comment:3 Changed 9 years ago by
Component: | unfiled → manipulation |
---|---|
Resolution: | → notabug |
Status: | new → closed |
This is not under the control of jQuery, and not even a bug. See http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#consume-a-character-reference for the relevant HTML5 character reference parsing logic:
Consume the maximum number of characters [immediately after the U+0026 AMPERSAND] possible, with the consumed characters matching one of the identifiers in the first column of the named character references table (in a case-sensitive manner).
Note that reg
appears in the table, so the first 4 characters of ®by
should be consumed and replaced by U+00AE REGISTERED SIGN (®).
comment:4 Changed 9 years ago by
If the character reference is being consumed as part of an attribute, and the last character matched is not a U+003B SEMICOLON character (;), and the next character is either a U+003D EQUALS SIGN character (=) or an alphanumeric ASCII character, then, for historical reasons, all the characters that were matched after the U+0026 AMPERSAND character (&) must be unconsumed, and nothing is returned.
So try: $('#report').html('®=®®by')
comment:5 Changed 9 years ago by
The point is, this is not a jQuery bug. If you have issues with the standard, contact the W3C and ask them to change the rules.
or try this: $('#report').html("®by")