Hello again. :)
In my application I tend to use a lot of national characters in wide character format, mainly in interface element placement. Apparently I cannot use methods that take a std::wstring or just const wchar_t * as LUA state just panics when I try to use them.
Basically I can have methods like:
void PrintWide(const wchar_t * characters)
{
wprintf(L"%s", characters);
}
void PrintWideStr(std::wstring str)
{
wprintf(L"%s", str.c_str());
}
And then call it from LUA like:
PrintWide("膮膷臋臈寞拧懦奴")
PrintWideStr("膮膷臋臈寞拧懦奴")
and it just fails with wrong userdata.
What are the solutions to add such support?
Thank you very much for such a great library, too. :)
Would #140 be helpful?
As a side note, wstring is not a Unicode string. You should be using std::u16string or std::u32string to handle localization. wstring is an implementation-defined string of wchar_t which can have any encoding that the implementation/locale sees fit.
Thanks for the sugestions. :) I might be too old-schooled at that. I will investigate both #140 and the u16/u32 strings for now. :)
Codecvt is a piece of shit: 
Support is in now: https://github.com/ThePhD/sol2/releases/tag/v2.11.3
The code you wrote at first should work.
Awesome! It does work. :)