There is a FileField model field, where in my particular case the html files are html .

Files of the wrong encoding are often uploaded (according to the instructions, utf8 necessary, but cp1251 is cp1251 ) - now they are stored as they are and are converted on the fly when they are returned.

It seems to me that it would be correct to convert them immediately after uploading.

In what side to dig?

  • Perhaps it is worth looking at the signals docs.djangoproject.com/en/1.10/topics/signals (and specifically on pre_save ). - Flowneee
  • FileField stores only the path to the file, not the file itself. - Mr. Fix
  • Perhaps you should not shift to the user. Determine the encoding before returning and convert, or spot the error and convert on the server. - Igor

0