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

Add UTF-8 configuration option for wil::ResultException::what() #238

Open
reupen opened this issue Apr 28, 2022 · 6 comments
Open

Add UTF-8 configuration option for wil::ResultException::what() #238

reupen opened this issue Apr 28, 2022 · 6 comments

Comments

@reupen
Copy link

reupen commented Apr 28, 2022

Hi,

Am I right in thinking that wil::ResultException::what() returns an ANSI-encoded string?

It'd be useful to be able to configure the library to return a UTF-8 string instead.

Thanks

@CookiePLMonster
Copy link
Contributor

Alternately - .whatW() that returns an Unicode string? Might be a viable approach too.

@reupen
Copy link
Author

reupen commented May 5, 2022

Yes, that would be useful as well. For me personally, UTF-8 would be simpler as I'm already generally dealing with it and so could avoid special handling for wil::ResultException.

@vonj
Copy link

vonj commented May 5, 2022 via email

@CookiePLMonster
Copy link
Contributor

Not all UTF8 strings can be represented in UCS2, though?

5 maj 2022 kl. 23:22 skrev Reupen Shah @.***>:  Yes, that would be useful as well. For me personally, UTF-8 would be simpler as I'm already generally dealing with it and so could avoid special handling for wil::ResultException. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

Windows uses UTF-16, not UCS-2.

@vonj
Copy link

vonj commented May 6, 2022

Right. I might have thought about the fact that fileNAMES in Windows can contain data which is not valid UTF16.

nodejs/node#23735

@lanyizi
Copy link

lanyizi commented Jun 8, 2022

IIRC all standard c++ exceptions' what() uses encoding of "current locale's code page", which normally happens to be ANSI code page.
For example, std::system_error with std::system_category on MSVC, or std::filesystem::filesystem_error.

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

4 participants