-
Notifications
You must be signed in to change notification settings - Fork 761
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
XML and JSON archives do not support serialization of wide strings but should #95
Comments
We could probably patch this in to cereal by creating a templated JSON/XML archive and using a typedef to keep the current interface the same (giving the templated version some similar but distinct name). I'm tempted to just roll this into the xml/json overhaul as part of supporting streaming though, since we may be starting with essentially a blank slate there. |
This is really tough because wide strings don't define what encoding they are in, and the JSON spec requires them to be unicode (chromium and folly only support UTF8 for parsing under the hood!). Really C++ needs a sane unicode string implementation haha. Edit: On linux it's safe to assume they are in unicode already, however on windows it depends on the current codepage |
C++11 does provide a sane unicode string implementation:
Ideally, you shouldn't be using |
I also ran into problems by using wchar/wstring when using console AND file output under Windows. The file written with a wstring would be 0 Bytes while using unicode characters with std::string works perfectly. Whereas a unicode output to the console works best with wstring and wcout once you choose the right font for the shell you're using. Ai ai caramba 🌵 |
Some common libraries, like boost::filesystem, use wstring/wchar internally. In these cases, it's unavoidable. |
And windows unicode builds uses wchar_t. So essentially we will have to convert all wstring to string before serializing (not knowing much about unicode encodings). |
Yeah and it should stay there. |
… (input / output). When new archive sets are added, we need only update the archive_type_list in common.hpp Note that filesystem cannot yet use this approach because it requires wchar, which XML and JSON do not yet support (Issue USCiLab#95)
The binary archives do support wide character string (wstring, wchar_t), but XML and JSON archives do not.
The text was updated successfully, but these errors were encountered: