summaryrefslogtreecommitdiffstats
path: root/tools/glusterfind/src/changelog.py
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2016-03-21 16:57:48 +0530
committerAravinda VK <avishwan@redhat.com>2016-03-30 22:13:36 -0700
commit9942c049dc45958fe88db28e120a6571c055a9c7 (patch)
tree424aee492b92924ad5989bf762e89ebec8dc1a58 /tools/glusterfind/src/changelog.py
parentac6899c7eaae9983f00645109a569e75f1d0a72a (diff)
tools/glusterfind: Handling Unicode file names
Unicode filenames handled cleanly with this patch. Changelog files and output files are opened with utf-8 encoding using codecs.open. urllib.quote_plus and unquote_plus will not handle Unicode so, encode Unicode to 8-bit string version before calling unquote. urllib.quote_plus requires 8-bit string itself so do not decode to Unicode if we need to use quote_plus(when --no-encode=false). Decode to unicode in --no-encode is set. BUG: 1322431 Change-Id: If5561c749ab5529445650d322c831eb4da22b65a Signed-off-by: Aravinda VK <avishwan@redhat.com> Reviewed-on: http://review.gluster.org/13798 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Milind Changire <mchangir@redhat.com> Reviewed-by: Kotresh HR <khiremat@redhat.com> (cherry picked from commit 48a0a38fadf9c5164869a908dcff8a951aa21b4b) Reviewed-on: http://review.gluster.org/13856
Diffstat (limited to 'tools/glusterfind/src/changelog.py')
-rw-r--r--tools/glusterfind/src/changelog.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/glusterfind/src/changelog.py b/tools/glusterfind/src/changelog.py
index a58a7ebebe3..283a035fe0e 100644
--- a/tools/glusterfind/src/changelog.py
+++ b/tools/glusterfind/src/changelog.py
@@ -17,6 +17,7 @@ import logging
from argparse import ArgumentParser, RawDescriptionHelpFormatter
import hashlib
import urllib
+import codecs
import libgfchangelog
from utils import mkdirp, symlink_gfid_to_path
@@ -212,7 +213,7 @@ def parse_changelog_to_db(changelog_data, filename, args):
"""
Parses a Changelog file and populates data in gfidpath table
"""
- with open(filename) as f:
+ with codecs.open(filename, encoding="utf-8") as f:
changelogfile = os.path.basename(filename)
for line in f:
data = line.strip().split(" ")