From 9942c049dc45958fe88db28e120a6571c055a9c7 Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Mon, 21 Mar 2016 16:57:48 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/13798 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Milind Changire Reviewed-by: Kotresh HR (cherry picked from commit 48a0a38fadf9c5164869a908dcff8a951aa21b4b) Reviewed-on: http://review.gluster.org/13856 --- tools/glusterfind/src/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/glusterfind/src/utils.py') diff --git a/tools/glusterfind/src/utils.py b/tools/glusterfind/src/utils.py index b3b0bdfffa3..b05f08ee5f6 100644 --- a/tools/glusterfind/src/utils.py +++ b/tools/glusterfind/src/utils.py @@ -242,4 +242,4 @@ def output_path_prepare(path, args): if args.no_encode: return path else: - return urllib.quote_plus(path) + return urllib.quote_plus(path.encode("utf-8")) -- cgit