class BundleNormalizer {

  protected static String normalize(String s) {
    Require.nonNull(s, "parameter s may not be null or empty.");

    // first replace umlauts with two-characters
    s= replaceUmlauts(s);

    // then replace some special characters
    s= s.replaceAll("[\\ \\.\\-\n/]+", "_");

    // then remove all diacritics and all characters not US_ASCII or numbers
    s= Normalizer
            .normalize(s, Normalizer.Form.NFKD)
            .replaceAll("[^\\P{M}]", "")
            .replaceAll("[^\\p{Alnum}\\_\\-\\ ]", "");

    // then replace multiple underscores with only one underscore
    s= s.replaceAll("[_]+", "_");

    // remove all leading and trailing underscores
    s= s.replaceAll("^_", "").replaceAll("_$", "");

    return s;
  }

}

class BundleNormalizerTest {

  @Test
  public void testNormalize() {

    final String input = "Tĥïŝ-ĩš â__fůňķŷ_Šťŕĭńġ.äÄüÿÆ¼.!/\\?+*]{[}$#@@!$%^&&ß!$%&'()*+,-./:;<=>?@[\\]^_`{|}~\"";
    final String expected= "This_is_a_funky_String_aeAEueyAE14_ss";

    final String actual= BundleNormalizer.normalize(input);

    assertThat(actual).isEqualTo(expected);
  }

}