Update ReplaceIllegalCharactersInPath to handle quirks in HFS+ and VFAT

This change:

- Re-introduces U+200C and U+200D as illegal characters since these are
  ignored on HFS+ and can interfere with filename sanitization. All code
  points in the Cf general category are now considered illegal in a
  filename.

- Leading and trailing WSpace and '.' characters are now considered
  illegal.

- Due to being confused for short names on VFAT filesystems, the tilde
  ('~') is now considered illegal.

- Prior to this change, only ASCII whitespace were trimmed from
  filenames on Mac OSX. All UTF-8 encoded WSpace characters are now
  handled on Mac OSX.

- Instead of trimming leading and trailing whitespace, they are now
  replaced by the replacement character. Trimming could cause a
  previously hidden extension or basename to be exposed.

BUG=444102
BUG=446538

Review URL: https://codereview.chromium.org/869823003

Cr-Commit-Position: refs/heads/master@{#314041}


CrOS-Libchrome-Original-Commit: 92a354fca8d118ad1be38612f85aa71a9a25303b
3 files changed
tree: 5a9e05bb6e2167b42f8575185c0258a7c76a1c9f
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/