Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization issue in vwindows_error #2274

Closed
phprus opened this issue May 9, 2021 · 6 comments
Closed

Localization issue in vwindows_error #2274

phprus opened this issue May 9, 2021 · 6 comments

Comments

@phprus
Copy link
Contributor

phprus commented May 9, 2021

Microsoft STL system error category use FormatMessageA to make error description (https://github.com/microsoft/STL/blob/a8efb53f4e571957671226271da20deb1e3832b8/stl/src/syserror_import_lib.cpp#L49).

On non-English Windows, std::system_category(). message() returns a result other than format_windows_error.

Possible solution: Create custom utf8-ready error_category for using in vwindows_error (https://github.com/fmtlib/fmt/blob/master/src/os.cc#L105)

Failed tests (Russian Windows 7 SP1):

[----------] Global test environment tear-down
[==========] 55 tests from 6 test suites ran. (8 ms total)
[  PASSED  ] 52 tests.
[  FAILED  ] 3 tests, listed below:
[  FAILED  ] util_test.utf16_to_utf8_error
[  FAILED  ] os_test.format_long_windows_error
[  FAILED  ] os_test.windows_error

 3 FAILED TESTS
@phprus
Copy link
Contributor Author

phprus commented May 9, 2021

And SEH exception:

F:\...\fmt\src\test\os-test.cc(131): error: Expected: (result)
!= (0), actual: 0 vs 0
unknown file: error: SEH exception with code 0xc0000005 thrown in the test body.

[  FAILED  ] os_test.format_long_windows_error (2 ms)

@phprus
Copy link
Contributor Author

phprus commented May 9, 2021

For test os_test.format_long_windows_error: error in commit
4b885c8#diff-9fb4e28ec2b9c93ff34b557433378a7f22ebdef90a692bf372896f18347afa0bL96-R105

@phprus
Copy link
Contributor Author

phprus commented May 9, 2021

I have implemented a prototype solution using utf8-ready error_category.
After testing, I will create a PR.

@vitaut
Copy link
Contributor

vitaut commented May 9, 2021

A separate error category sounds like a good idea.

@phprus
Copy link
Contributor Author

phprus commented May 9, 2021

Separate error category need only for Windows.

phprus added a commit to phprus/fmt that referenced this issue May 9, 2021
@phprus
Copy link
Contributor Author

phprus commented May 9, 2021

Done: #2275

phprus added a commit to phprus/fmt that referenced this issue May 10, 2021
phprus added a commit to phprus/fmt that referenced this issue May 10, 2021
vitaut pushed a commit that referenced this issue May 10, 2021
@vitaut vitaut closed this as completed May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants