- TODO support non-UTF-8 encodings
This commit is contained in:
Ian Kent 2014-11-23 16:10:47 +00:00
parent bb46bac58f
commit 66ca91749f
2 changed files with 16 additions and 1 deletions

View file

@ -163,6 +163,21 @@ mailhogApp.controller('MailCtrl', function ($scope, $http, $sce, $timeout) {
}, 10);
}
$scope.tryDecodeContent = function(message, content) {
var charset = "UTF-8"
if(message.Content.Headers["Content-Type"][0]) {
// TODO
}
if(message.Content.Headers["Content-Transfer-Encoding"][0]) {
if(message.Content.Headers["Content-Transfer-Encoding"][0] == "quoted-printable") {
content = unescapeFromQuotedPrintable(content, charset)
}
}
return content
}
$scope.getMessagePlain = function(message) {
var l = $scope.findMatchingMIME(message, "text/plain");
if(l != null && l !== "undefined") {

View file

@ -228,7 +228,7 @@
</ul>
<div class="tab-content">
<div ng-if="hasHTML(preview)" ng-class="{ active: hasHTML(preview) }" class="tab-pane" id="preview-html" ng-bind-html="preview.previewHTML"></div>
<div class="tab-pane" ng-class="{ active: !hasHTML(preview) }" id="preview-plain">{{ getMessagePlain(preview) }}</div>
<div class="tab-pane" ng-class="{ active: !hasHTML(preview) }" id="preview-plain">{{ tryDecodeContent(preview, getMessagePlain(preview)) }}</div>
<div class="tab-pane" id="preview-source">{{ getSource(preview) }}</div>
<div class="tab-pane" id="preview-mime">
<div ng-repeat="part in preview.MIME.Parts" class="mime-part">