function jsonPointerEncodeAndReplace(filePathName) {
  return encodeURIComponent(filePathName.replace(tildes, escapedTildeString).replace(slashes, escapedSlashString));
}
Encodes a filepath name so it can be a json pointer
replaces tildes and slashes for ~0 and ~1
@param {string} filePathName the filePathName of the file
@returns {string} - the encoded filepath