Skip to content

Commit

Permalink
bugfix: calendar from file
Browse files Browse the repository at this point in the history
Signed-off-by: Armin Wieser <armin.wieser@gmail.com>
  • Loading branch information
awieser committed May 24, 2012
1 parent d9bad21 commit cf1dfa0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions 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
Expand Down Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions 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
Expand All @@ -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
Expand Down

0 comments on commit cf1dfa0

Please sign in to comment.