mime: respect charset header (default to utf-8)

This commit is contained in:
Vincent Breitmoser
2015-09-16 19:54:57 +02:00
parent ece06b1933
commit 6624d1f830
7 changed files with 21 additions and 25 deletions

View File

@@ -172,7 +172,13 @@ public class InputDataOperation extends BaseOperation<InputDataParcel> {
log.add(LogType.MSG_DATA_MIME_LENGTH, 3, totalLength);
OpenPgpMetadata metadata = new OpenPgpMetadata(mFilename, bd.getMimeType(), 0L, totalLength);
String charset = bd.getCharset();
// the charset defaults to us-ascii, but we want to default to utf-8
if ("us-ascii".equals(charset)) {
charset = "utf-8";
}
OpenPgpMetadata metadata = new OpenPgpMetadata(mFilename, bd.getMimeType(), 0L, totalLength, charset);
out.close();
outputUris.add(uri);

View File

@@ -34,9 +34,6 @@ public class DecryptVerifyResult extends InputPendingResult {
OpenPgpSignatureResult mSignatureResult;
OpenPgpDecryptionResult mDecryptionResult;
OpenPgpMetadata mDecryptionMetadata;
// This holds the charset which was specified in the ascii armor, if specified
// https://tools.ietf.org/html/rfc4880#page56
String mCharset;
CryptoInputParcel mCachedCryptoInputParcel;
@@ -96,14 +93,6 @@ public class DecryptVerifyResult extends InputPendingResult {
mDecryptionMetadata = decryptMetadata;
}
public String getCharset () {
return mCharset;
}
public void setCharset(String charset) {
mCharset = charset;
}
public void setOutputBytes(byte[] outputBytes) {
mOutputBytes = outputBytes;
}