Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | blob_append_json_literal() now escapes hard tab, newlines, and carriage returns. Fixes /jchunk loading of makefiles and potentially files with any stray carriage returns. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0f7740b6329e533852a948f07992a8c1 |
User & Date: | stephan 2021-09-11 18:39:07 |
Original Comment: | blob_append_json_literal() now escapes hard tab, newlines, and carriage returns. Fixes /jchunk loading of makefiles and windows text files. |
Context
2021-09-11
| ||
19:20 | Enhance blob_append_json_literal() so that it escapes all control characters. ... (check-in: 810576be user: drh tags: trunk) | |
18:39 | blob_append_json_literal() now escapes hard tab, newlines, and carriage returns. Fixes /jchunk loading of makefiles and potentially files with any stray carriage returns. ... (check-in: 0f7740b6 user: stephan tags: trunk) | |
18:01 | darkmode skin: give SELECT elements a color combination which is visible, as reported in forum post 9a87b3e40d. ... (check-in: ee0b76a7 user: stephan tags: trunk) | |
Changes
Changes to src/blob.c.
︙ | ︙ | |||
397 398 399 400 401 402 403 404 405 406 | blob_append_char(pOut, '"'); } void blob_append_json_literal(Blob *pOut, const char *z, int n){ int i; blob_append_char(pOut, '"'); for(i=0; i<n; i++){ char c = z[i]; switch( c ){ case '"': case '\\': | > > > > > > > | < | < | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | blob_append_char(pOut, '"'); } void blob_append_json_literal(Blob *pOut, const char *z, int n){ int i; blob_append_char(pOut, '"'); for(i=0; i<n; i++){ char c = z[i]; char esc = 0; switch( c ){ case '\t': c = 't'; case '"': case '\\': esc = 1; break; case '\r': c = 'r'; esc = 1; break; case '\n': c = 'n'; esc = 1; break; } if(esc) blob_append_char(pOut, '\\'); blob_append_char(pOut, c); } blob_append_char(pOut, '"'); } /* ** Return a pointer to a null-terminated string for a blob. |
︙ | ︙ |