Open kevmeister68 opened 2 years ago
Hi, jwt-cpp doesn't support Unicode, because JWT's are defined to use UTF-8. UTF-8 is generally useful for these kinds of tasks because it is equivalent to ASCII for most of the letters which are usually found in a token and has the nice property of not containing 0 bytes (meaning ascii functions like strlen work as expected). Most json libraries should be binary safe (meaning if your string contains 0 bytes they should be preserved) but they return a std string. Basically you have two options:
wstring_convert
for this.I'd recommend going with the second approach because it's easier to maintain and probably more performant.
The original reason I added the traits was for cpprestsdk, which on Windows uses a wstring... There are still parts of the API the are locked to std::string
and I know of other implementations which went with approach two.
If you are looking to contribute, wide string support would be amazing ❤️
EDIT:
I forgot to mention it's also important to pick a good JSON library, for example nlohmann's library does handle content with unicode characters which might be an alternative (if you can always work with std::string
).
Can someone please clarify how jwt-cpp supports Unicode or non-unicode (ANSI) implementations, in terms of:
(I am specifically referring to using this on Windows).
Thanks