Add widechar checks

Import the wide char toxic commit from core and adapt the build scripts to detect wide char support.