Merge patch from Scott McKellar for better Unicode handling