Initial contributions for Linux provided in issue #1233, modified to work on both Windows and Linux. Dual support is possible by detecting the sizeof wchar_t which is different on each of these systems.