lib: fix typeof value check
lib: fix non-ASCII utf8 character encoding