Get utf8_size from WideCharToMultiByte instead of guessing it

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Improved error handling

Signed-off-by: Sven Strickroth <email@cs-ware.de>