Seite 1 von 1

QWindowsMime - Problem

Verfasst: 20. November 2004 12:42
von Christian81
Hallo

Habe ein kleines Problem mit QWindowsMime. Ich versuche einen Text nach "plain/text" zu wandeln:

Code: Alles auswählen

#include <qmime.h>

int main( int argc, char **argv )
{
	const char *text1 = "Hallo text\n oder doch\r\n wer weiss?";
    QWindowsMime::initialize();
	
	QWindowsMime *mime = QWindowsMime::convertor (QWindowsMime:: cfToMime(1), 1 );

	QString qstring(text1);

	QCString qcstring = qstring.local8Bit();

	QCString qcstring2 = mime->convertToMime(qcstring,"plain/text",1);

	const char *text2 = qcstring2.data();

	qDebug("text1: pos10: %x pos11: %x pos21: %x pos22: %x",
		    text1[0x0a], text1[0x0b], text1[0x15], text1[0x16]);

	qDebug("text2: pos10: %x pos11: %x pos21: %x pos22: %x",
		    text2[0x0a], text2[0x0b], text2[0x15], text2[0x16]);

	return 0;
}
Mein Problem dabei ist, dass Qt 3.21 non commercial mir die Zeilenenden nicht mit CRLF sondern nur mir LF am Ende erzeugt (siehe Ausgabe von text2). Allerdings sagt mir der RFC-Standard (http://www.rfc-editor.org/rfc/rfc2046.txt, 4.1.1. Representation of Line Breaks) dass text/*** immer mit CRLF abgeschlossen werden muss. Deshalb hier meine Frage ob evtl. jemand mit einer offiziellen Qt3 - Lizenz und aktuellen Qt-Version schauen kann ob es evtl. nur ein Fehler ist und in 3.3.3 koorigiert ist.

Verfasst: 23. November 2004 13:06
von Goos
Hallo,

in Version 3.3.3 ists noch genauso.
Man findest im Quellcode z.B. einen im Input String ( if (c!='\r')... )
Also wirst in deinem Ergebnis niamals irgendwelche CR`s finden, wenn du an ConvertToMime ein CF_TEXT uebergibst. Bei CF_UNICODETEXT schauts dann allerdings wieder anders aus.

Goos