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ň <kuk...@gmail.com> wrote:

> 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
> generated properly, but as soon as you deploy, and the first client enters
> some data from OSX for example, you have a problem which you couldn't even
> notice before. What I'm trying to say here is that I think it's better if
> it was consistent, and you could catch the issue during implementation.
>
> 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 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 same as split() (maybe also
>> with an ivar for controlling the behavior, although I'm not sure if it's
>> needed). What do you think?
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/3c773fc0-7049-4d66-ae14-9a322e884774%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/3c773fc0-7049-4d66-ae14-9a322e884774%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFO84S5iAmyAc%2Byf1BXgZ6X5Cr5vwxujmoPDBqaUDXhDFm%2BhGA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to