tracker r1097 - in trunk: . extensions/thunderbird-extension extensions/thunderbird-extension/content
- From: michalpryc svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1097 - in trunk: . extensions/thunderbird-extension extensions/thunderbird-extension/content
- Date: Thu, 17 Jan 2008 12:05:42 +0000 (GMT)
Author: michalpryc
Date: Thu Jan 17 12:05:42 2008
New Revision: 1097
URL: http://svn.gnome.org/viewvc/tracker?rev=1097&view=rev
Log:
2008-01-17 Michal Pryc <michal dot pryc at sun dot com>
* Patch from Mathieu Dimanche <mdimanche at free dot fr>
Fixed character encoding problems between Thunderbird
and trackerd, a.k.a. UTF-8 encoded TMS files
Modified:
trunk/ChangeLog
trunk/extensions/thunderbird-extension/content/trackerIndexer.js
trunk/extensions/thunderbird-extension/tracker.xpi
Modified: trunk/extensions/thunderbird-extension/content/trackerIndexer.js
==============================================================================
--- trunk/extensions/thunderbird-extension/content/trackerIndexer.js (original)
+++ trunk/extensions/thunderbird-extension/content/trackerIndexer.js Thu Jan 17 12:05:42 2008
@@ -50,13 +50,25 @@
return;
}
- stream.write ('<' + type + ">\n", type.length + 3);
+ // HOWTO write unicode-encoded strings :
+ // http://developer.mozilla.org/en/docs/Writing_textual_data
+ var ustream = Components.classes["@mozilla.org/intl/converter-output-stream;1"]
+ .createInstance(Components.interfaces.nsIConverterOutputStream);
+ try {
+ ustream.init (stream, 'UTF-8', 0, 0x0000);
+ } catch (ex) {
+ dump ('Failed to write unicode index file: ' + ex + "\n");
+ return;
+ }
+
+ ustream.writeString ('<' + type + ">\n");
for (var key in hashtable) {
var line = '<' + key + '><![CDATA[' + hashtable [key] + ']]></' + key + ">\n";
- stream.write (line, line.length);
+ ustream.writeString (line);
}
- stream.write ("</" + type + ">\n", type.length + 4);
+ ustream.writeString ("</" + type + ">\n");
+ ustream.close ();
stream.close ();
}
@@ -340,7 +352,7 @@
// We must ensure that all elements exist. Some of them might throw an exception in various
// set-ups, so we have to catch them and default to something.
- properties ['Author'] = hdr.author;
+ properties ['Author'] = hdr.mime2DecodedAuthor;
properties ['Date'] = hdr.dateInSeconds;
properties ['Folder'] = hdr.folder.name;
properties ['FolderFile'] = hdr.folder.path.unixStyleFilePath;
@@ -356,8 +368,8 @@
properties ['MessageSize'] = hdr.messageSize;
properties ['MessageOffset'] = hdr.messageOffset;
properties ['OfflineSize'] = hdr.offlineMessageSize;
- properties ['Recipients'] = hdr.recipients;
- properties ['Subject'] = hdr.subject;
+ properties ['Recipients'] = hdr.mime2DecodedRecipients;
+ properties ['Subject'] = hdr.mime2DecodedSubject;
properties ['MessageKey'] = hdr.messageKey;
try {
Modified: trunk/extensions/thunderbird-extension/tracker.xpi
==============================================================================
Binary files. No diff available.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]