Previous patch incorrectly implemented swapping UTF16 byte order. Hope this should work alright, but I want to make sure beforehand.
I tried this patch on powerpc64 (BE) and it fixed the problem.