An ASCII check operates on bytes. A string that looks simple after display normalization may still require multibyte encoding.
Worked example
import { Buffer, isUtf8, isAscii } from "node:buffer";
console.log(isAscii(Buffer.from("café")));Result
falseImplementation notes
ASCII validity does not imply safe or printable text. Control characters still fall within the ASCII range.
Try it yourself
Compare a plain hyphen with an en dash encoded as UTF-8.
Open the Node.js example →Editorial date August 12, 2026 · Published December 6, 2026