added multibyte/unicode support.