From 01af554fea0ba2996bc3f267ed6b1cbaff03821c Mon Sep 17 00:00:00 2001 From: ilektrojohn Date: Sun, 5 Jan 2014 17:49:36 +0100 Subject: [PATCH] encoding fixes --- creepy/CreepyMain.py | 6 +++--- creepy/plugins/flickr/flickr.py | 4 ++-- creepy/plugins/instagram/instagram.py | 2 +- creepy/plugins/twitter/twitter.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/creepy/CreepyMain.py b/creepy/CreepyMain.py index 853ba4a..33e0976 100644 --- a/creepy/CreepyMain.py +++ b/creepy/CreepyMain.py @@ -408,7 +408,7 @@ def updateCurrentLocationDetails(self, index): ''' location = self.locationsTableModel.locations[index.row()] self.ui.currentTargetDetailsLocationValue.setText(location.shortName) - self.ui.currentTargetDetailsDateValue.setText(location.datetime.strftime('%a %b %d,%H:%M:%S %z')) + self.ui.currentTargetDetailsDateValue.setText(location.datetime.strftime('%Y-%m-%d %H:%M:%S %z')) self.ui.currentTargetDetailsSourceValue.setText(location.plugin) self.ui.currentTargetDetailsContextValue.setText(location.context) @@ -548,8 +548,8 @@ def showPersonProjectWizard(self): personProjectWizard.ProjectWizardSelectedTargetsTable = ProjectWizardSelectedTargetsTable([], self) if personProjectWizard.exec_(): project = Project() - project.projectName = unicode(personProjectWizard.ui.personProjectNameValue.text(), 'utf-8') - project.projectKeywords = [keyword.strip() for keyword in unicode(personProjectWizard.ui.personProjectKeywordsValue.text(), 'utf-8').split(',')] + project.projectName = unicode(personProjectWizard.ui.personProjectNameValue.text().toUtf8(), 'utf-8') + project.projectKeywords = [keyword.strip() for keyword in unicode(personProjectWizard.ui.personProjectKeywordsValue.text().toUtf8(), 'utf-8').split(',')] project.projectDescription = personProjectWizard.ui.personProjectDescriptionValue.toPlainText() project.enabledPlugins = personProjectWizard.readSearchConfiguration() project.dateCreated = datetime.datetime.now() diff --git a/creepy/plugins/flickr/flickr.py b/creepy/plugins/flickr/flickr.py index 9223369..252391d 100644 --- a/creepy/plugins/flickr/flickr.py +++ b/creepy/plugins/flickr/flickr.py @@ -117,7 +117,7 @@ def getLocationsFromPhotos(self, photos): if photo.attrib['latitude'] != '0': loc = {} loc['plugin'] = "flickr" - photo_link = 'http://www.flickr.com/photos/%s/%s' % (photo.attrib['owner'], photo.attrib['id']) + photo_link = unicode('http://www.flickr.com/photos/%s/%s' % (photo.attrib['owner'], photo.attrib['id']), 'utf-8') title = photo.attrib['title'] #If the title is a string, make it unicode if isinstance(title,str): @@ -160,7 +160,7 @@ def returnLocations(self, target, search_params): def constructContextInfoWindow(self, link, date): html = unicode(self.options_string['infowindow_html'], 'utf-8') - return html.replace("@LINK@",link).replace("@DATE@",date.strftime("%a %b %d,%H:%M:%S %z")).replace("@PLUGIN@", u"flickr") + return html.replace("@LINK@",link).replace("@DATE@",date.strftime("%Y-%m-%d %H:%M:%S %z")).replace("@PLUGIN@", u"flickr") def getLabelForKey(self, key): ''' diff --git a/creepy/plugins/instagram/instagram.py b/creepy/plugins/instagram/instagram.py index b3cc189..673ae42 100644 --- a/creepy/plugins/instagram/instagram.py +++ b/creepy/plugins/instagram/instagram.py @@ -184,7 +184,7 @@ def showWarning(self, title, text): def constructContextInfoWindow(self, photo): html = unicode(self.options_string['infowindow_html'],'utf-8') caption = photo.caption.text if photo.caption else unicode('No Caption', 'utf-8') - return html.replace("@TEXT@",caption).replace("@DATE@",photo.created_time.strftime("%a %b %d,%H:%M:%S %z")).replace("@PLUGIN@", u"instagram").replace("@LINK@", photo.link) + return html.replace("@TEXT@",caption).replace("@DATE@",photo.created_time.strftime("%Y-%m-%d %H:%M:%S %z")).replace("@PLUGIN@", u"instagram").replace("@LINK@", photo.link) def getLabelForKey(self, key): diff --git a/creepy/plugins/twitter/twitter.py b/creepy/plugins/twitter/twitter.py index 9b1ef20..c44616b 100644 --- a/creepy/plugins/twitter/twitter.py +++ b/creepy/plugins/twitter/twitter.py @@ -243,7 +243,7 @@ def constructContextInfoWindow(self, tweet): html = unicode(self.options_string['infowindow_html'], 'utf-8') #returned value also becomes unicode since tweet.text is unicode, and carries the encoding also - return html.replace("@TEXT@",tweet.text).replace("@DATE@",tweet.created_at.strftime("%a %b %d,%H:%M:%S %z")).replace("@PLUGIN@", u"twitter") + return html.replace("@TEXT@",tweet.text).replace("@DATE@",tweet.created_at.strftime("%Y-%m-%d %H:%M:%S %z")).replace("@PLUGIN@", u"twitter") def getCenterOfPolygon(self, coord): '''