Provide more flexible string truncation in libphutil

Summary:
Ref T3307. We sometimes need to truncate strings to a given length for display, storage, or for other reasons.

Currently, `phutil_utf8_shorten()` can do this for display, but because it handles combining characters it doesn't actually impose any storage limits on the result: if the input is `o` and 50 megabytes of combining umlauts, the output will be the same as the input, since this is only "1 display character" long.

Instead, allow truncation to specify maximum byte, codepoint (utf8 character) and glyph (display character) limits.

Test Plan: Added more unit tests.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T3307

Differential Revision: https://secure.phabricator.com/D9368
Fall back to slow UTF8 algorithms that don't crash

Summary:
Fixes T5316. PCRE can blow stacks on `(x|y)+` regexps, and a user is hitting a consistent fatal in PCRE.

Rewrite the fallback for `phutil_is_utf8()` to be iterative. This is somewhat slower, but not normally too horrible, and we have a variety of ways to mitigate that if it arises as a real issue (encourage installation of mb extension, ship a fast C extension, etc).

We already have most of this code anyway.

Test Plan: We have fairly good test coverage here already, I mostly just realigned the existing test coverage to explicitly call the new code.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: webframp, epriestley

Maniphest Tasks: T5316

Differential Revision: https://secure.phabricator.com/D9472
Lint JSON files with `ArcanistJSONLinter`.

Summary: After D9628, we can lint JSON files natively.

Test Plan: See D9652.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9653
Update library map for `phutil_is_utf8_slowly`.

Summary: It appears that `arc liberate` wasn't run for D9472.

Test Plan: Meh...

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9665
Minor whitespace changes.

Summary:
A few minor whitespace changes:

- Change tabs to spaces.
- Don't change tabs to spaces in test cases.
- Don't apply `.editorconfig` rules to the `externals` directory.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9673
Improve the exception message for JSON parsing exceptions.

Summary: Provide contextual information relating to JSON parser exceptions.

Test Plan: See D9679.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9680