This _should_ fix the issue with certain characters in the latin-1 range breaking strings.

Also casts various string types to utf-8 to try and alleviate some issues -though  I'm not sure it will help 100%.  May still need to cast the string at actual execution time.