Fix bytes/unicode handling in POSIX version