Re: normalizing newlines in form fields

2018-11-12 Thread Jakub Kleň
>From what I have read so far, it would be probably better to normalize to '\r\n'. On Monday, November 12, 2018 at 3:58:39 PM UTC+1, Jakub Kleň wrote: > > I'm thinking if it wouldn't be nice if django automatically normalized > newlines of data entered by the user. The implementation would be re

Re: normalizing newlines in form fields

2018-11-12 Thread Collin Anderson
Maybe the newline character could be part of the setting, something like normalize_newlines_to='\n'. And then just do a normalize_newlines_to.join(value.splitlines()) could work. On Mon, Nov 12, 2018 at 10:49 AM Jakub Kleň wrote: > Regarding the link you sent, I also think that the current behav

Re: normalizing newlines in form fields

2018-11-12 Thread Jakub Kleň
Regarding the link you sent, I also think that the current behaviour is inconsistent. I'm now not sure if we should go with \n, or \r\n, but I think we definitely should normalize this. If you are writing to files on windows, all your browsers would send \r\n over post, so the files would be ge

Re: normalizing newlines in form fields

2018-11-12 Thread Jakub Kleň
Reason: Having consistent data representation in the database is nice, and maybe also useful in some use-cases, e.g. using the data to train a deep learning model. This tweak seems it could only help, and shouldn't break anything. If, for some reason a developer needs to use \r\n for display, he

Re: normalizing newlines in form fields

2018-11-12 Thread Tim Graham
Here's a ticket that was closed as wontfix. If you want it reconsidered, you should explain why you the think the arguments there aren't valid. https://code.djangoproject.com/ticket/19251 On Monday, November 12, 2018 at 9:58:39 AM UTC-5, Jakub Kleň wrote: > > I'm thinking if it wouldn't be nice i

normalizing newlines in form fields

2018-11-12 Thread Jakub Kleň
I'm thinking if it wouldn't be nice if django automatically normalized newlines of data entered by the user. The implementation would be really simple, there's already a function for it in django.utils.text.normalize_newlines, and it would go into django.forms.fields.CharField.to_python the sam