redis中get值显示为16进制字符串的解决方法

Linux系统中,通过xshell登录redis,当根据某个key进行get取值时,取到的值为“xc2xedxc0xadxcbxb9xbcxd3”格式的十六进制字符串,原因是值中的中文以十六进制的格式输出。要解决这个问题,可以在启动Redis客户端如下加入参数:

./redis-cli --raw

参照官方文档:

This time (integer) was omitted from the output since the CLI detected the output was no longer written to the terminal. You can force raw output even on the terminal with the --raw option:

即:加上--raw之后就可以在终端上强制原始输出,也就是将中文输出而不是输出的是一串utf-8编码字符串。

原文地址:https://www.cnblogs.com/zjfjava/p/11664273.html