Check if html files contain non ASCII characters.
This commit is contained in:
@ -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"));
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user