This commit is contained in:
yuin 2021-10-16 18:56:49 +09:00
parent f5dcbd8208
commit bc90544cef
2 changed files with 16 additions and 2 deletions

View file

@ -496,3 +496,17 @@ _a[b_c_](d)
//- - - - - - - - -// //- - - - - - - - -//
<pre><code>\t x\n</code></pre> <pre><code>\t x\n</code></pre>
//= = = = = = = = = = = = = = = = = = = = = = = =// //= = = = = = = = = = = = = = = = = = = = = = = =//
38: Decimal HTML entity literals should allow 7 digits
//- - - - - - - - -//
&#7654321;
//- - - - - - - - -//
<p>\uFFFD</p>
//= = = = = = = = = = = = = = = = = = = = = = = =//
39: Decimal HTML entities should not be interpreted as octal when starting with a 0
//- - - - - - - - -//
&#0100;
//- - - - - - - - -//
<p>d</p>
//= = = = = = = = = = = = = = = = = = = = = = = =//

View file

@ -745,8 +745,8 @@ func (d *defaultWriter) Write(writer util.BufWriter, source []byte) {
} else if nc >= '0' && nc <= '9' { } else if nc >= '0' && nc <= '9' {
start := nnext start := nnext
i, ok = util.ReadWhile(source, [2]int{start, limit}, util.IsNumeric) i, ok = util.ReadWhile(source, [2]int{start, limit}, util.IsNumeric)
if ok && i < limit && i-start < 8 && source[i] == ';' && i-start < 7 { if ok && i < limit && i-start < 8 && source[i] == ';' {
v, _ := strconv.ParseUint(util.BytesToReadOnlyString(source[start:i]), 0, 32) v, _ := strconv.ParseUint(util.BytesToReadOnlyString(source[start:i]), 10, 32)
d.RawWrite(writer, source[n:pos]) d.RawWrite(writer, source[n:pos])
n = i + 1 n = i + 1
escapeRune(writer, rune(v)) escapeRune(writer, rune(v))