tags:

views:

77

answers:

2

The file is uploaded through a Django form. The contents of the file need to be saved into a models.TextField(), for editors to review it before publication.

I am already checking UploadedFile.content_type. I have considered using a regular input field, but as the text is going to be quite long, it would be unwieldy for users to cut and paste.

+2  A: 

Google is your friend on this one - see here

stevejalim
Well, this seems the best answer; although the method is maybe a bit overkill in this case.
Ludovico Fischer
A: 

Not all sequences of bytes are valid for ex. UTF-8, maybe you should check this?

Maciej Kucharz