changed calculations for converting between encodings into some that should work cross platform. unicodeToUtf8.c