File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,17 @@ class Permissions(object):
59
59
60
60
61
61
def make_digest_acl_credential (username , password ):
62
- """Create a SHA1 digest credential"""
62
+ """Create a SHA1 digest credential.
63
+
64
+ .. note::
65
+
66
+ This function uses UTF-8 to encode non-ASCII codepoints,
67
+ whereas ZooKeeper uses the "default locale" for decoding. It
68
+ may be a good idea to start the JVM with `-Dfile.encoding=UTF-8`
69
+ in non-UTF-8 locales.
70
+ See: https://github.com/python-zk/kazoo/pull/584
71
+
72
+ """
63
73
credential = username .encode ('utf-8' ) + b":" + password .encode ('utf-8' )
64
74
cred_hash = b64encode (hashlib .sha1 (credential ).digest ()).strip ()
65
75
return username + ":" + cred_hash .decode ('utf-8' )
Original file line number Diff line number Diff line change @@ -169,6 +169,12 @@ def run(self):
169
169
"java" ,
170
170
"-cp" , self .classpath ,
171
171
172
+ # make_digest_acl_credential assumes UTF-8, but ZK decodes
173
+ # digest auth packets using the JVM's default "charset"--which
174
+ # depends on the environment. Force it to use UTF-8 to avoid
175
+ # test failures.
176
+ "-Dfile.encoding=UTF-8" ,
177
+
172
178
# "-Dlog4j.debug",
173
179
"-Dreadonlymode.enabled=true" ,
174
180
"-Dzookeeper.log.dir=%s" % log_path ,
You can’t perform that action at this time.
0 commit comments