add char_count and find_error

Signed-off-by: Bing Li <bili@redhat.com>