mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-06 03:08:02 -05:00
Force utf-8 charset in text/calendar attachments and replace invalid characters
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@125 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
3be56bc928
commit
f6c66f5106
@ -619,6 +619,22 @@ public class ExchangeSession {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (".".equals(line)) {
|
||||
line = "..";
|
||||
// patch text/calendar to include utf-8 encoding
|
||||
} else if ("Content-Type: text/calendar;".equals(line)) {
|
||||
StringBuffer headerBuffer = new StringBuffer();
|
||||
headerBuffer.append(line);
|
||||
while ((line = reader.readLine()) != null && line.startsWith("\t")) {
|
||||
headerBuffer.append((char) 13);
|
||||
headerBuffer.append((char) 10);
|
||||
headerBuffer.append(line);
|
||||
}
|
||||
if (headerBuffer.indexOf("charset") < 0) {
|
||||
headerBuffer.append(";charset=utf-8");
|
||||
}
|
||||
headerBuffer.append((char) 13);
|
||||
headerBuffer.append((char) 10);
|
||||
headerBuffer.append(line);
|
||||
line = headerBuffer.toString();
|
||||
// detect html body to patch Exchange html body
|
||||
} else if (line.startsWith("<html")) {
|
||||
inHTML = true;
|
||||
@ -627,6 +643,7 @@ public class ExchangeSession {
|
||||
}
|
||||
if (inHTML) {
|
||||
line = line.replaceAll("’", "'");
|
||||
line = line.replaceAll("…", "...");
|
||||
}
|
||||
isoWriter.write(line);
|
||||
isoWriter.write((char) 13);
|
||||
|
Loading…
Reference in New Issue
Block a user