First attempt whether we have a COLUMNS environment variable so we don't have to spawn a subprocess if we don't have to. Otherwise first check stty, then tput. The first should be almost always available already and should be the most reliable choice to try first.
We depended here on it being signed for the return value, but for 32 bit systems we need it to be a uint32_t for the correct limits. This changes it to use an explicit return whether we succeeded or not and store the result in a separate variable. Fixes #1864
Encoding.asciicompat_encoding returns nil if the Encoding is ascii compatible. If an Encoding *is* returned, that Encoding is ascii compatible by definition. Hence, this spec is already covered.