Commit 612810af authored by antirez's avatar antirez
Browse files

sdscatrepr() fixed. Now newlines and other special chars are escaped correctly

parent 4eddb121
...@@ -399,11 +399,11 @@ sds sdscatrepr(sds s, char *p, size_t len) { ...@@ -399,11 +399,11 @@ sds sdscatrepr(sds s, char *p, size_t len) {
case '"': case '"':
s = sdscatprintf(s,"\\%c",*p); s = sdscatprintf(s,"\\%c",*p);
break; break;
case '\n': s = sdscatlen(s,"\\n",1); break; case '\n': s = sdscatlen(s,"\\n",2); break;
case '\r': s = sdscatlen(s,"\\r",1); break; case '\r': s = sdscatlen(s,"\\r",2); break;
case '\t': s = sdscatlen(s,"\\t",1); break; case '\t': s = sdscatlen(s,"\\t",2); break;
case '\a': s = sdscatlen(s,"\\a",1); break; case '\a': s = sdscatlen(s,"\\a",2); break;
case '\b': s = sdscatlen(s,"\\b",1); break; case '\b': s = sdscatlen(s,"\\b",2); break;
default: default:
if (isprint(*p)) if (isprint(*p))
s = sdscatprintf(s,"%c",*p); s = sdscatprintf(s,"%c",*p);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment