WICG / scroll-to-text-fragment

Proposal to allow specifying a text snippet in a URL fragment
Other
586 stars 43 forks source link

The spec is unclear on the relationship of percent-encoding and Unicode #230

Closed hsivonen closed 8 months ago

hsivonen commented 12 months ago

The spec says:

A text directive is a kind of directive representing a range of text to be indicated to the user. It is a struct that consists of four strings: start, end, prefix, and suffix.

So start, end, prefix, and suffix are defined as strings, though without a link to the Infra notion of "string".

The spec then says:

Set retVal’s prefix to the percent-decoding of the result of removing the last character from potential prefix.

Percent-decode returns a byte sequence but the spec assigns the return value to prefix, which is a string. (Likewise for start, end, and suffix.)

The spec should say whether the byte sequence is converted to a string by applying UTF-8 decode without BOM or by applying UTF-8 decode without BOM or fail (and what happens on failure if the latter).

hsivonen commented 12 months ago

Evidently Chrome uses UTF-8 decode without BOM.