I think we should define once and for all what, unless specifically mentioned otherwise, we mean on this site when we say:
- ASCII
- Printable ASCII
There are many versions of (extended) ASCII, and I think we should have a default.
I think we should define once and for all what, unless specifically mentioned otherwise, we mean on this site when we say:
There are many versions of (extended) ASCII, and I think we should have a default.
ASCII characters are all Unicode characters with code points from 0x00 to 0x7F (both inclusive).
Printable ASCII characters all are Unicode characters with code points from 0x20 to 0x7E (both inclusive). This does not include linefeeds.
This is consistent with the definition of printable character as one that occupies a printing position. Linefeeds are control characters that move the cursor down (or the paper up) and thus do not satisfy the definition of printability.
While including linefeeds in the printable ASCII characters would be practical if everybody was familiar with our convention, it is non-standard and bound to cause confusion. The spec of a challenge should be as long as needed to explain all the details, and adding and linefeeds doesn't make it a lot longer...
The definition of ASCII on this site should be the typical 7-bit ASCII, which contains 128 characters.
Printable ASCII includes the 95 characters found in this chart, which are listed below:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
For the purposes of this site we should include the line feed character (\n
) in this definition.
\n
is a cross-platform line break and pretty much everything on this site that requires line breaks uses \n
. I don't see the benefit of including \r
as well.
\$\endgroup\$
\n
as printable.
\$\endgroup\$
\n
is plain confusing since when you Google "printable ascii" the first result is the Wikipedia article that clearly excludes \n
.
\$\endgroup\$
Sep 3, 2015 at 21:29
\t
in this definition too - it generates printable(!) spaces until horizontal position became multiple of 8. When analyzing program's output there should be no difference between printing 8 spaces and printing 1 tab. When printing on paper or when displaying text on computer monitor, the result is absolutely the same.
\$\endgroup\$
Oct 17, 2015 at 21:16