I test redis and jedis API for encoding ISO-8859-5:
String S = new String("Привет мир".getBytes(), "ISO-8859-5");
redis.lpush("test", S);
System.out.println(redis.lpop("test"));
In result, I have: а�б�аИаВаЕб� аМаИб�
Then I try to use SafeEncoder:
String S = new String("Привет мир".getBytes(), "ISO-8859-5");
redis.lpush("test", S);
byte[] Result = SafeEncoder.encode(redis.lpop("test"));
System.out.println(new String(Result));
Result: аАТаБТаАааАааАааБТ аАааАааБТ
What I do wrong开发者_运维百科? Is it me or redis, or jedis?
You can use the binary form directly
byte[] b = "Привет мир".getBytes();
redis.lpush(SafeEncoder.encode("test"), b);
System.out.println(redis.lpop("test"));
Try convert information to UTF-8.
by the way, if you have problems with cyrrilic encoding , this site may help you ( 2cyr.com )
精彩评论