Handle non-ASCII strings in header anchors #591
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Comes in two parts:
Overall it should fix #538 for Japanese and any other Unicode characters.
I considered adding heuristics to append a hash if more than X characters were removed, but decided against it because it may break someone's links. This may be beneficial if one have multiple headers in a foreign language that include some ASCII characters. Now every anchor for such headers would only contain said characters, giving duplicate anchors.
(sdbm implementation from
hash_link_ref
could be used instead of djb2, but that will introduce cross-dependencies)Unlike #539 (which is also valid in principle) this change is self-contained. It doesn't depend on OpenSSL dev headers or anything else. Promise to require no installed libraries is kept.