* Avoid using a global for is_ascii * Fix unused var, missing init, and use size_t for length * Use snprintf where possible