From 5a4bcc1bc92bd5a90df2ee73f4ad2564313785f3 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Mon, 21 Jan 2019 05:39:53 +0000 Subject: [PATCH] MAINT: Prefer FS encoding over UTF-8 --- pandas/io/parsers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index b31d3f665f47f2..6bf0425e6cdd25 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -1315,7 +1315,8 @@ def _validate_usecols_arg(usecols): # see gh-13253 # # Python 2.x compatibility - usecols = {col.encode("utf-8") for col in usecols} + encoding = sys.getfilesystemencoding() or "utf-8" + usecols = {col.encode(encoding) for col in usecols} return usecols, usecols_dtype return usecols, None