digitalmars.D - CRLF in wysiwyg string literals?
- Lionello Lunesu (14/14) May 11 2016 Writing a lot of server side D code lately, and bummed the usual `string...
- Kagamin (2/2) May 12 2016 For HTTP you can't use anything but escape sequences. AFAIK, they
- Lionello Lunesu (3/5) May 12 2016 Not just HTTP, MIME multipart/mixed content also requires CRLF, as does
Writing a lot of server side D code lately, and bummed the usual `string literals` (or r"string literals") will only use '\n' as the End of line character, while HTTP (and others too) use CRLF for EOL. One way is to create a CTFE function that replaces all \n with \r\n, and call this on all string literals. Another idea I just had was to reserve the rn prefix for such strings, ie. rn"This string uses CRLF new lines." The rn prefix would reflect the usual \r\n CRLF pairs. (Perhaps confusing, since the r doesn't actual mean CR, and there's no n prefix either.) Just a thought. How have others solved this? Short of using \r\n\r\n, that is. L.
May 11 2016
For HTTP you can't use anything but escape sequences. AFAIK, they apply only to protocol headers, the content can be anything.
May 12 2016
On 12/5/2016 16:38, Kagamin wrote:For HTTP you can't use anything but escape sequences. AFAIK, they apply only to protocol headers, the content can be anything.Not just HTTP, MIME multipart/mixed content also requires CRLF, as does application/http content.
May 12 2016