Fix #3961 : use char range methods (not byte offsets) to detect whitespace

Fix for #3961.  Also includes a test case to illustrate the issues.  (All of the entries that say "should align" should align with each other, and the four lines near the end that say "compare _" for _ in {A,B,C,D} should line up with each other.)

Before applying this change set:
-- the "(should align)"'s are all over the place, and the form/line feeding spaces are not cut out as one might or might not expect.
-- compare B and D do not match A and C.

(To be honest, its hard to really say what the *right* behavior is here, and people who are expecting a particular behavior out of a pretty printer in these cases may well get burned.)