Can I (and if I can, how do I) enforce a specific string encoding for running lua scripts with jedis?

时间:2015-09-01 22:33:48

标签: java lua redis jedis

I suspect that jedis decodes my string to the wrong byte set before calling my lua script. Can I configure which string encoding/decoding algorithm or function is used?

Context

I'm calling a lua script from jedis, somewhat like so:

evalResponse = jedis.eval(aLuaScriptString, 1, someKey, Double.toString(aDouble), new String(aByteArray, ‘UTF-8’), Integer.toString(anInteger));

where the lua script performs a zadd:

redis.call('zadd', KEYS[1], ARGV[1], ARGV[2])

When I retrieve the byteArray from redis, it contains a different set of bytes than the ones I sent in.

Since the string representations of the retrieved bytes, and the bytes I'm sending in are identical, I strongly suspect that somewhere along the jedis/lua invocation path my string is decoded to bytes differently than how I encoded it.

0 个答案:

没有答案