Re: CRLF in wysiwyg string literals?

2016-05-12 Thread Lionello Lunesu via Digitalmars-d

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.


Re: CRLF in wysiwyg string literals?

2016-05-12 Thread Kagamin via Digitalmars-d
For HTTP you can't use anything but escape sequences. AFAIK, they 
apply only to protocol headers, the content can be anything.


CRLF in wysiwyg string literals?

2016-05-11 Thread Lionello Lunesu via Digitalmars-d
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.