fix utf8
This commit is contained in:
parent
da2ae85c51
commit
71bae2c750
2 changed files with 3 additions and 3 deletions
|
@ -36,7 +36,7 @@ const main = () => {
|
||||||
|
|
||||||
// Send the file to the user
|
// Send the file to the user
|
||||||
const blob = new Blob([
|
const blob = new Blob([
|
||||||
atob(decrypted_file.split(";base64,").pop()),
|
decodeURIComponent(atob(decrypted_file)),
|
||||||
]);
|
]);
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
download(url, decrypted_filename);
|
download(url, decrypted_filename);
|
||||||
|
|
|
@ -71,9 +71,9 @@ const update = (element, text, tag = undefined) => {
|
||||||
*/
|
*/
|
||||||
const send = (file, element) => {
|
const send = (file, element) => {
|
||||||
let reader = new FileReader();
|
let reader = new FileReader();
|
||||||
reader.readAsDataURL(file);
|
reader.readAsText(file);
|
||||||
reader.onload = () => {
|
reader.onload = () => {
|
||||||
const content = reader.result.split(";base64,").pop();
|
const content = btoa(encodeURIComponent(reader.result));
|
||||||
|
|
||||||
if (file.size > 512000 || file.size == 0) {
|
if (file.size > 512000 || file.size == 0) {
|
||||||
let message = file.size == 0 ? "vide" : "trop lourd (max ~500ko)";
|
let message = file.size == 0 ? "vide" : "trop lourd (max ~500ko)";
|
||||||
|
|
Reference in a new issue