21

Working with Redis 2.10 using redis-cli on Linux, I am faced with a problem regarding accents.

If I execute the command :

set "string" "à"

I get \xc3\xa0, it seems each converted accent begin with \xc3.

How do I get my original string back?

kozher
  • 695
  • 4
  • 10
  • 18

4 Answers4

39

Try using

redis-cli --raw

It solved problem for me.

Moonwalker
  • 2,180
  • 1
  • 29
  • 48
  • 1
    Unfortunately this only works within the CLI, but not if you directly run the command all in one line (such as: redis-cli --raw HGETALL myHashKey > mqResult.txt). – Austin Salgat Nov 17 '17 at 02:19
9

"\xc3\xa0" is just Unicode "à" in UTF-8 encoding. Just decode the string and you're done...

simon
  • 15,344
  • 5
  • 45
  • 67
2
<you string>.encode("utf-8")

when you need get the string do

<you string>.decode("utf-8")
H.Tina
  • 87
  • 4
0

You need to spec the version of Redis and more importantly the client you are using.

If you are using a telnet client, the problem may be your client. Redis supports arbitrary bytes for values and UTF-8 is not a problem at all (if your client is properly converting the entered glyphs to the associated byte sequence.)

alphazero
  • 27,094
  • 3
  • 30
  • 26