The `std::collate` bug is only triggered on the VS 2017 image on
appveyor hence it is the only one where `collation_works` returns false
and the `utf8_collator_from_wide` is used.
So to collect coverage for that this is the configuration to do it.
The `std::collate` bug is only triggered on the VS 2017 image on
appveyor hence it is the only one where `collation_works` returns false
and the `utf8_collator_from_wide` is used.
So to collect coverage for that this is the configuration to do it.
On that affected system:
- `col.compare("a", "b") == col.compare("b", "a") == 1`
- hence `locale("a", "b") == locale("b", "a")`
- `col.transform("a")` thows `std::length_error(string too long)`
To avoid this we fallback to `utf8_collator_from_wide` instead
This was removed as it is basically forwarding the call and hence looks
very similar to what `std::time_put_by_name` does.
However the `ios_base&` in the `do_put` function is actually used to
e.g. translate weekday names or determine the date format to use
(e.g. whether the year has 2 or 4 digits
or month comes before or after the days: dd/mm vs mm/dd)
Very likely the `std::locale::name` is used for that so we need to pass
a `std::ios_base&` with a locale that was constructed by the requested name.
Creating a base locale with a seemingly random facet makes it hard to
understand as this specific facet is only required in the class.
Passing the name and creating the required facet in the class is easier
to understand as creation and usage are closer.
Document the meaning of the `utf8_support` enum and refactor/change
usages to be consistent and logical. Add comments where required.
Rename `native_with_wide` to `native` after that got free for use as
there is no `native_without_wide`.
E.g. on Linux this is required or `ctype<wchar_t>.toupper` will not
correctly handle unicode characters.
Refactor to a loop over possible fallbacks to use with from_wide
and combine it with the Windows locale name case.
Also try different spellings of the encoding as e.g. some stdlibs want
"utf8" while others only accept "UTF-8".
Move the interleaved checks for WinAPI to the using function.
Also refactor `normalize_encoding` & `encoding_to_windows_codepage`
to take `string_view` and make the latter always available.
When `to_windows_name` failed to returned `"C"` which is loadable and
hence skips the fallback locale check.
So check if a valid windows_name was returned.
Replace the failure by using the C-locale with `utf8_support::from_wide`
similar to the non-UTF-8 codepath such that if the `info` facet returns
UTF-8 then it is really used and not (likely) US-ASCII.
Instead of doing a combined formatting and comparison of many format
parts (`as::date`, `as::time` & `as::datetime`) test each one
individually to be able to spot issues easier when it fails