-
Notifications
You must be signed in to change notification settings - Fork 52
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 support for approving strings with Unicode characters #154
Comments
Thanks Clare. My initial fix was to add two functions to StringMaker class: #include <codecvt>
static std::string StringMaker::toString(const std::wstring wstr)
{
static std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> utf8_converter;
return utf8_converter.to_bytes(wstr);
}
static std::string StringMaker::toString(const wchar_t* wstr)
{
static std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> utf8_converter;
return utf8_converter.to_bytes(wstr);
} Though since I'm not familiar enough with the framework I preferred not to modify it and resorted to overload operator<<. Another issue is that |
Super - thanks Omer... This may possible help on the deprecation front... https://stackoverflow.com/questions/42946335/deprecated-header-codecvt-replacement |
Co-Authored-By: Llewellyn Falco <[email protected]>
This is failing to build on both Cygwin and mingw: https://ci.appveyor.com/project/isidore/approvaltests-cpp/builds/35837411 |
Also several GitHub Actions jobs are failing too: (Window with MSVC compiler and both Ubuntu) |
And GCC and Clang on Ubuntu in Travis: |
Adding this fixed my Ubuntu builds - and maybe the other failures too: #include <locale> |
The code we added for this causes the pprovalTests.cpp.StarterProject builds to fail on all GitHub Actions CI builds, where warnings are treated as errors - in the v.10.5.0 release: https://github.com/approvals/ApprovalTests.cpp.StarterProject/runs/1350196515?check_suite_focus=true
|
It is the deprecation issue of . |
This will allow this project to build in Visual Studio, until approvals/ApprovalTests.cpp#154 is fixed.
Unfortunately we are going to remove the In case it helps anyone else out, the code was: namespace ApprovalTests
{
std::string StringMaker::toString(const std::wstring& wstr)
{
static std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> utf8_converter;
return utf8_converter.to_bytes(wstr);
}
std::string StringMaker::toString(const wchar_t* wstr)
{
static std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> utf8_converter;
return utf8_converter.to_bytes(wstr);
}
} |
A test using Unicode directly remains. Co-Authored-By: Llewellyn Falco <[email protected]>
We're closing this, as no further action is intended until C++ properly supports unicode, on a language version that we can use. In the meantime we recommend using a 3rd-party library if you need to support unicode. |
Co-Authored-By: Llewellyn Falco <[email protected]>
The was described by a user, who needed to be able to print wchar.
They were able to add wostream overloads to write out wide-strings
http://www.cplusplus.com/reference/ostream/wostream/
It would be good to build that support in.
The text was updated successfully, but these errors were encountered: