Fixed crashes on decoding unicode

Attempts to convert into UTF-8, then latin1 if the value is a string, otherwise calls unicode() as before.