Skip to content

Commit

Permalink
Fix for Localization issues #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Kokkelkoren committed Dec 8, 2015
1 parent 33955dc commit 0e17f65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:name>Todo.txt Extension</em:name>
<em:version>0.3</em:version>
<em:version>0.4</em:version>
<em:type>2</em:type>
<em:creator>Roy Kokkelkoren</em:creator>
<em:description>Thunderbird extension for the Todo.txt application</em:description>
Expand Down
10 changes: 7 additions & 3 deletions modules/todoclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,24 @@ let todoClient = {
this.writeTodo(todo);
else
throw Components.Exception("Deleted item not found in Todo.txt",Components.results.NS_ERROR_UNEXPECTED);

},

setTodo: function(){
let parseBlob = "";
let prefs = this.getPreferences();

let utf8Converter = Components.classes["@mozilla.org/intl/utf8converterservice;1"].
getService(Components.interfaces.nsIUTF8ConverterService);

if(prefs.prefHasUserValue('todo-txt')){

todoFile = prefs.getComplexValue("todo-txt", Components.interfaces.nsIFile);
let fstream = Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(Components.interfaces.nsIFileInputStream);

fstream.init(todoFile, -1, 0, 0);
let data = NetUtil.readInputStreamToString(fstream, fstream.available());
let str = NetUtil.readInputStreamToString(fstream, fstream.available());
let data = utf8Converter.convertURISpecToUTF8(str, "UTF-8");
parseBlob += data;
}

Expand All @@ -189,7 +192,8 @@ let todoClient = {
createInstance(Components.interfaces.nsIFileInputStream);

fstream.init(doneFile, -1, 0, 0);
let data = NetUtil.readInputStreamToString(fstream, fstream.available());
let str = NetUtil.readInputStreamToString(fstream, fstream.available());
let data = utf8Converter.convertURISpecToUTF8(str, "UTF-8");
parseBlob += "\n"+data;
}

Expand Down

0 comments on commit 0e17f65

Please sign in to comment.