package org.mamute.infra;

import java.text.Normalizer;
import java.text.Normalizer.Form;
import java.util.Locale;
import java.util.regex.Pattern;

public class NormalizerBrutal {
	public static String toSlug(String input) {
		if(input == null || input.isEmpty()) return "";
		Pattern NONLATIN = Pattern.compile("[^\\w-]");
		Pattern WHITESPACE = Pattern.compile("[\\s]");
		String nowhitespace = WHITESPACE.matcher(input).replaceAll("-");
		String normalized = Normalizer.normalize(nowhitespace, Form.NFD);
		String slug = NONLATIN.matcher(normalized).replaceAll("");
		return slug.toLowerCase(Locale.ENGLISH);
	}
}

@@ -222,16 +222,17 @@
 ) %7B%0A%09%09if
+ 
 (input =
@@ -502,16 +502,144 @@
 m.NFD);%0A
+//%09%09if (locale != null && locale.getLanguage().equals(%22fa%22)) %7B%0A//%09%09%09return normalized.toLowerCase(Locale.ENGLISH);%0A//%09%09%7D else %7B%0A
 %09%09String
@@ -734,13 +734,19 @@
 GLISH);%0A
+//%09%09%7D%0A
 %09%7D%0A%7D%0A

permit non-english characters in question url