public void cleanName(String forbiddenCharacters, char replacementCharacter, int maxLength) {
    // An album name is allowed to be null, handled on the importer level if there is a problem with
    // this value, so we support it here
    if (name == null) {
      return;
    }
    name =
        name.chars()
            .mapToObj(c -> (char) c)
            .map(
                c -> forbiddenCharacters.contains(Character.toString(c)) ? replacementCharacter : c)
            .map(Object::toString)
            .collect(Collectors.joining(""))
            .trim();
    if (maxLength <= 0 || maxLength >= name.length()) {
      return;
    }
    name = name.substring(0, maxLength).trim();
  }
This allows us to make album names palatable, removing unpalatable characters and enforcing
length rules.
portability-types-common/src/main/java/org/datatransferproject/types/common/models/photos/PhotoAlbum.java