14
\$\begingroup\$

I think we should define once and for all what, unless specifically mentioned otherwise, we mean on this site when we say:

  1. ASCII
  2. Printable ASCII

There are many versions of (extended) ASCII, and I think we should have a default.

| |
\$\endgroup\$
  • 5
    \$\begingroup\$ This is one of the most contentious meta questions I've ever seen. \$\endgroup\$ – isaacg Sep 3 '15 at 10:33
26
\$\begingroup\$

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...

| |
\$\endgroup\$
  • 5
    \$\begingroup\$ I believe that including linefeeds should be the standard, as it would have to be mentioned as an exception a lot of questions. \$\endgroup\$ – orlp Sep 3 '15 at 3:03
  • 7
    \$\begingroup\$ I don't think that saving a few bytes when writing up a challenge warrants using non-standard terminology that most readers of the challenge won't be familiar with. \$\endgroup\$ – Dennis Sep 3 '15 at 3:05
  • 3
    \$\begingroup\$ +1 This is the definition given by Wikipedia which I commonly link to in challenges. If I want newlines or tabs to be included as well I say so. \$\endgroup\$ – Calvin's Hobbies Sep 3 '15 at 21:23
  • 5
    \$\begingroup\$ @orlp If we really want a standard including linefeeds, that could only be called PPCG standard ASCII or something. Calling it by the name of something with a different definition is really confusing. \$\endgroup\$ – jimmy23013 Sep 4 '15 at 7:44
-4
\$\begingroup\$

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.

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ IMO anyway. ¯\_(ツ)_/¯ \$\endgroup\$ – Alex A. Sep 3 '15 at 1:22
  • \$\begingroup\$ What about \r? \$\endgroup\$ – orlp Sep 3 '15 at 1:32
  • \$\begingroup\$ @orlp I wouldn't consider that printable. \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\$ – Alex A. Sep 3 '15 at 1:34
  • 2
    \$\begingroup\$ Every printable-ascii question I've checked does not inlude \n as printable. \$\endgroup\$ – isaacg Sep 3 '15 at 7:39
  • \$\begingroup\$ +1 Line breaks are technically printable, so why not include them? \$\endgroup\$ – Beta Decay Sep 3 '15 at 10:15
  • 5
    \$\begingroup\$ @BetaDecay They're not. A printable character is one that occupies a printing position. \$\endgroup\$ – Dennis Sep 3 '15 at 17:35
  • 4
    \$\begingroup\$ Including \n is plain confusing since when you Google "printable ascii" the first result is the Wikipedia article that clearly excludes \n. \$\endgroup\$ – Calvin's Hobbies Sep 3 '15 at 21:29
  • \$\begingroup\$ We should include tab character \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\$ – Egor Skriptunoff Oct 17 '15 at 21:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .