Indicate UTF-8 instead of letting browsers guess. #15
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.
Checklist
Description of Changes
Indicate UTF-8 instead of letting browsers guess.
Since I'm using HTML5 style, also indicate HTML5 with
<!DOCTYPE html>
Bacterius from Discord confused my local programming channel when UTF-8 encoded copyright symbols (©) found in popular licenses such as rdrand 0.4.0's MIT license were misrendered, gaining an extra accented A (©). But not always!
This turned out to be his browser (Chrome) incorrectly guessing the locale was windows-1252 or similar. Since Rust strings are all supposed to be UTF-8 anyways, I think it's safe to claim the output is UTF-8 as well.
If there do happen to be license files with other encodings, translation 'should' happen when first loaded - or better yet, the files themselves should be converted.
Related Issues
None found
Not Changed
I considered suggesting
<html lang="en">
as well, although language autodetection is much less likely to go wrong - and"en"
might even be incorrect if there's ever a lot of licenses written in, say, Japanese, in some corners of the rust ecosystem. Plus language misdetection shouldn't cause rendering bugs.Unrelated Chatter
Nice crate! I've created some proc macros wrapping cargo-about to make license text trivial to embed in command line applications. It's also dual
MIT OR Apache-2.0
licensed, so feel free tostealupstream any parts of it you find interesting ;).Bacterius also suggested maybe adding the ability to approve licenses via Cargo.toml to reduce the amount of file clutter. It does have a
[metadata]
section that could be used for exactly this kind of thing, although I don't mind one way or the other personally:https://doc.rust-lang.org/cargo/reference/manifest.html#the-metadata-table-optional
https://docs.rs/cargo_metadata/0.9.1/cargo_metadata/struct.Package.html#structfield.metadata
There's also been some chatter about embedding licenses for the Rust stdlib. I actually did some work on enumerating stdlib crates (when stdlib src is installed/available) for licensing information myself before I realized cargo-about existed - let me know if you'd be interested in me trying to extend cargo-about with some of that code. (No promises I'll make the time thought!)