Skip to content

Commit 8609a41

Browse files
committedJun 9, 2013
allow utf8 in metadata.txt
1 parent 95dcd96 commit 8609a41

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed
 

‎python/pyplugin_installer/installer_data.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from PyQt4.QtNetwork import *
2929
import sys
3030
import os
31+
import codecs
3132
import ConfigParser
3233
import qgis.utils
3334
from qgis.core import *
@@ -556,12 +557,10 @@ def pluginMetadata(fct):
556557
if not os.path.exists(metadataFile):
557558
return "" # plugin has no metadata.txt file
558559
cp = ConfigParser.ConfigParser()
559-
res = cp.read(metadataFile)
560-
if not len(res):
561-
return "" # failed reading metadata.txt file
562560
try:
561+
cp.readfp(codecs.open(metadataFile, "r", "utf8"))
563562
return cp.get('general', fct)
564-
except Exception:
563+
except:
565564
return ""
566565

567566
if readOnly:

‎python/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import re
3939
import ConfigParser
4040
import warnings
41+
import codecs
4142

4243
#######################
4344
# ERROR HANDLING
@@ -129,8 +130,10 @@ def findPlugins(path):
129130
continue
130131

131132
cp = ConfigParser.ConfigParser()
132-
res = cp.read(metadataFile)
133-
if len(res) == 0:
133+
134+
try:
135+
cp.readfp(codecs.open(metadataFile, "r", "utf8"))
136+
except:
134137
return None # reading of metadata file failed
135138

136139
pluginName = os.path.basename(plugin)

0 commit comments

Comments
 (0)
Please sign in to comment.