Add primitive check for file encoding when a file is uploaded and warn

if it's not UTF-8

Close #8
This commit is contained in:
2022-11-28 14:27:46 +01:00
parent f5ea1f850a
commit 20810aa850
9 changed files with 32 additions and 15 deletions

View File

@ -7,6 +7,8 @@
declare(strict_types = 1);
require_once __DIR__ . "/../functions/functions.php";
const GET_PARAM_JS_CSS = "v000006";
/**
* Generates the json for a translation file.
*
@ -66,6 +68,10 @@ function generateTranslationFile(string $lang):string {
'help_what_is_csv_content' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'help_what_is_csv_content'),
'help_how_to_format_csv' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'help_how_to_format_csv'),
'help_how_to_format_csv_content' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'help_how_to_format_csv_content'),
'file_encoding_is_not_utf8' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'file_encoding_is_not_utf8'),
'non_utf8_file_instruction' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'non_utf8_file_instruction'),
]);
}
@ -83,7 +89,7 @@ function generateAppShell():string {
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.min.css?v000005" />
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.min.css?' . GET_PARAM_JS_CSS . '" />
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#aa4400" />
@ -106,7 +112,7 @@ function generateAppShell():string {
</head>
<body class="loading">
<script src="assets/js/csvxmlV2.min.js?v000005" type="text/javascript" async></script>
<script src="assets/js/csvxmlV2.min.js?' . GET_PARAM_JS_CSS . '" type="text/javascript" async></script>
</body>
</html>';