moji char predicates

This is a rebased version of PR #8110, addressing issue #5939.
cc @stevengj @ivarne
Oh, I didn't know that was a libc thing. It probably shouldn't change then.