Check if html files contain non ASCII characters.

This commit is contained in:
MobiusDevelopment
2020-02-08 02:41:23 +00:00
parent 0ed057dff9
commit 71576ed8af
714 changed files with 1240 additions and 1179 deletions

View File

@ -553,6 +553,7 @@ public class Config
public static boolean LOG_ITEMS;
public static boolean LAZY_CACHE;
public static boolean CHECK_HTML_ENCODING;
public static boolean IS_CRAFTING_ENABLED;
public static int DWARF_RECIPE_LIMIT;
@ -1384,6 +1385,7 @@ public class Config
LOG_ITEMS = Boolean.parseBoolean(generalSettings.getProperty("LogItems", "false"));
LAZY_CACHE = Boolean.parseBoolean(generalSettings.getProperty("LazyCache", "false"));
CHECK_HTML_ENCODING = Boolean.parseBoolean(generalSettings.getProperty("CheckHtmlEncoding", "true"));
REMOVE_CASTLE_CIRCLETS = Boolean.parseBoolean(generalSettings.getProperty("RemoveCastleCirclets", "true"));
ALT_GAME_VIEWNPC = Boolean.parseBoolean(generalSettings.getProperty("AltGameViewNpc", "false"));

View File

@ -140,6 +140,11 @@ public class HtmCache
final String relpath = Util.getRelativePath(Config.DATAPACK_ROOT, file);
final int hashcode = relpath.hashCode();
if (Config.CHECK_HTML_ENCODING && !StandardCharsets.US_ASCII.newEncoder().canEncode(content))
{
LOGGER.warning("HTML encoding check: File " + relpath + " contains non ASCII content.");
}
final String oldContent = _cache.get(hashcode);
if (oldContent == null)