Skip to content
Browse files

bugfix: calendar from file

Signed-off-by: Armin Wieser <armin.wieser@gmail.com>
  • Loading branch information...
1 parent d9bad21 commit cf1dfa0fd6326e88118cd311179d6b5760af9a6c @awieser awieser committed May 24, 2012
Showing with 6 additions and 5 deletions.
  1. +3 −2 memacs/ical.py
  2. +3 −3 memacs/lib/reader.py
View
5 memacs/ical.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Time-stamp: <2012-05-24 10:59:01 armin>
+# Time-stamp: <2012-05-24 19:18:21 armin>
import sys
import os
@@ -159,7 +159,8 @@ def __handle_vevent(self, component):
def _main(self):
# getting data
if self._args.calendar_file:
- data = CommonReader.get_data_from_file(self._args.calendar_file)
+ data = CommonReader.get_data_from_file(self._args.calendar_file,
+ encoding=None)
elif self._args.calendar_url:
data = CommonReader.get_data_from_url(self._args.calendar_url)
View
6 memacs/lib/reader.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Time-stamp: <2012-01-02 21:23:13 armin>
+# Time-stamp: <2012-05-24 19:08:10 armin>
import codecs
import logging
@@ -18,15 +18,15 @@ class CommonReader:
"""
@staticmethod
- def get_data_from_file(path):
+ def get_data_from_file(path, encoding='utf-8'):
"""
reads a file
@param file: path to file
@return: returns data
"""
try:
- input_file = codecs.open(path, 'rb', encoding='utf-8')
+ input_file = codecs.open(path, 'rb', encoding=encoding)
data = input_file.read()
input_file.close()
return data

0 comments on commit cf1dfa0

Please sign in to comment.
Something went wrong with that request. Please try again.