İ-character breaks cfhtmlhead

The İ-character, also known as dotted I, breaks the cfhtmlhead tag. If it is already located inside the HTML-head it shifts the cfhtmlhead tag’s output to the right.

Sample code to reproduce with:

<!DOCTYPE html>
<html>
<head>
    <title>İ-Test</title>
</head>
<body>
    <h1>Foo</h1>
</body>
</html>

<cfhtmlhead text="<meta />">

In the HTML output from Lucee the head end tag gets mangled: <<meta />/head>

I’ve tested the first 512 Unicode characters and only the İ-character seems to lead to this issue. Curiously, the more İ-characters there are, the more the output gets shifted.

Tested in TryCF and it occurs on Lucee 6. It was fine on 5. I can reproduce it locally on Lucee 7 as well, just not in TryCF. (In TryCF there are more issues: the content of cfhtmlhead is duplicated and on Lucee 7 the İ-character is changed to İ - but those are separate problems and probably only specific to TryCF).

Thanks for the nice bug report, bug filed

https://luceeserver.atlassian.net/browse/LDEV-6114

Wow, that was quick! :racing_car: Thank you for filing.

This example is artificial of course but we actually have a problem with this in production. We use cfhtmlhead to insert ld+json structured data (among other things) and this bug leads to the structured data being displayed at the top of the page. Browsers consider the head tag closed after the < in the mangled end tag and render the rest in the page body.

Our workaround is to encode the İ -character, but it needs different encoding depending on whether it’s HTML or JSON. The code for encoding also needed to be inserted in many different places. So the sooner we can remove this workaround, the better :wink: Waiting patiently!