Add check for setlocale()

In wide char mode it is important to be sure that setlocale() function
succeed.