summaryrefslogtreecommitdiffstats
path: root/libkcal/icalformat.cpp
diff options
context:
space:
mode:
authorEmanoil Kotsev <deloptes@gmail.com>2016-10-12 22:42:20 +0200
committerSlávek Banko <slavek.banko@axis.cz>2016-10-12 22:42:20 +0200
commit63c4d2db479e17f91e61616fd736185277524d89 (patch)
treea823a540a1ada158f87df840d4cb50d5f7f9e815 /libkcal/icalformat.cpp
parent105df0826eca906593e73a0a6333e3c867067ed2 (diff)
downloadtdepim-63c4d2db479e17f91e61616fd736185277524d89.tar.gz
tdepim-63c4d2db479e17f91e61616fd736185277524d89.zip
Fix utf8 handling in libkcal/icalformat
This resolves bug 2660 Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
Diffstat (limited to 'libkcal/icalformat.cpp')
-rw-r--r--libkcal/icalformat.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp
index 34a4a1a92..52f4777ea 100644
--- a/libkcal/icalformat.cpp
+++ b/libkcal/icalformat.cpp
@@ -88,14 +88,14 @@ bool ICalFormat::load( Calendar *calendar, const TQString &fileName)
return false;
}
TQTextStream ts( &file );
- ts.setEncoding( TQTextStream::Latin1 );
+ ts.setEncoding( TQTextStream::UnicodeUTF8 );
TQString text = ts.read();
file.close();
if ( text.stripWhiteSpace().isEmpty() ) // empty files are valid
return true;
else
- return fromRawString( calendar, text.latin1() );
+ return fromRawString( calendar, text.utf8() );
}
@@ -123,7 +123,8 @@ bool ICalFormat::save( Calendar *calendar, const TQString &fileName )
// Convert to UTF8 and save
TQCString textUtf8 = text.utf8();
- file.file()->writeBlock( textUtf8.data(), textUtf8.size() - 1 );
+ file.textStream()->setEncoding( TQTextStream::UnicodeUTF8 );
+ file.file()->writeBlock(textUtf8.data(),textUtf8.size()-1);
if ( !file.close() ) {
kdDebug(5800) << "KSaveFile: close: status was " << file.status() << ". See errno.h." << endl;