Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 6de63004 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr

Fix encoding for non-ascii filenames for TNEF.

Correctly decode attachement filenames as Latin1. Adding a unit test
to ensure this.

REVIEW: 122047
parent a2b5f780
......@@ -720,7 +720,7 @@ QString readMAPIString( QDataStream &stream, bool isUnicode, bool align,
if ( isUnicode ) {
res = QString::fromUtf16( ( const unsigned short *)buf );
} else {
res = QString::fromLocal8Bit( buf );
res = QString::fromLatin1( buf );
}
delete [] buf;
return res;
......
/*
Copyright (c) 2007 Volker Krause <vkrause@kde.org>
Copyright (c) 2013 Andreas Cord-Landwehr <cordlandwehr@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
......@@ -24,6 +25,7 @@
#include <ktnef/ktnefparser.h>
#include <ktnef/ktnefmessage.h>
#include <ktnef/ktnefattach.h>
#include <QString>
#include <qtest_kde.h>
......@@ -96,3 +98,18 @@ void ParserTest::testMAPIAttachments()
QVERIFY( att->size() == 68920 );
QVERIFY( att->name() == QString( "VIA_Nytt_14021.htm" ) );
}
void ParserTest::testUmlautAttachmentFilenames()
{
KTNEFParser parser;
QVERIFY( parser.openFile( TESTSOURCEDIR "umlaut-filename.tnef" ) == true );
KTNEFMessage *msg = parser.message();
QVERIFY( msg != 0 );
QList<KTNEFAttach*> atts = msg->attachmentList();
QVERIFY( atts.count() == 1 );
KTNEFAttach *att = atts.first();
QCOMPARE(att->fileName(), QString::fromUtf8("döcument.pdf"));
}
......@@ -29,6 +29,7 @@ class ParserTest : public QObject
void testSingleAttachment();
void testTwoAttachments();
void testMAPIAttachments();
void testUmlautAttachmentFilenames();
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment