# Diagnosing garbled binary values over Upstash REST
## Symptom
Values containing binary data come back with replacement characters
(U+FFFD) or fail JSON parsing. Text values are fine.
## Cause
REST responses are JSON. Bytes that are not valid UTF-8 cannot
survive JSON transport, so the API substitutes the replacement
character. Your stored bytes are intact; the read path mangled them.
## Confirm
Read the same key over the native protocol (redis-cli) or with
responseEncoding enabled in the SDK. If the bytes are correct there,
the REST text transport is the problem.
## Fix
Request base64 encoding:
curl https://YOUR_REST_URL/get/mykey \
-H "your auth header \
-H "Upstash-Encoding: base64"
The result field comes back base64-encoded; decode client side. In
@upstash/redis this is the default behavior, which is why SDK reads
work while raw curl reads look garbled.
Do not combine this header with Upstash-Response-Format: resp2. That
combination is a 400.
## Verify
Round trip known binary bytes and compare byte for byte after
decoding. Exact match means the transport is clean.