diff --git a/app/models/Attachment.java b/app/models/Attachment.java index 20e0a9d18..517190c5c 100644 --- a/app/models/Attachment.java +++ b/app/models/Attachment.java @@ -236,7 +236,7 @@ public boolean store(File file, String name, Resource container) throws IOExcept new BufferedInputStream(new FileInputStream(file)), meta); this.mimeType = mediaType.toString(); if (mediaType.getType().toLowerCase().equals("text")) { - this.mimeType += " ;charset=" + FileUtil.detectCharset(new FileInputStream(file)); + this.mimeType += "; charset=" + FileUtil.detectCharset(new FileInputStream(file)); } } diff --git a/test/models/AttachmentTest.java b/test/models/AttachmentTest.java index 9e51a5b86..5dd1c45cd 100644 --- a/test/models/AttachmentTest.java +++ b/test/models/AttachmentTest.java @@ -36,7 +36,7 @@ public void testSaveInUserTemporaryArea() throws IOException, NoSuchAlgorithmExc // Then assertThat(attach.name).isEqualTo("bar.txt"); - assertThat(attach.mimeType).isEqualTo("text/plain"); + assertThat(attach.mimeType).isEqualTo("text/plain; charset=UTF-8"); assertThat(new String(b, 0, length)).isEqualTo(new String("Hello")); }