﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27716	FieldFile incorrectly returns bytes the first time it is opened with 'r'	Tom Forbes	nobody	"This is strange. On the latest 1.10 release with Python 3.5.2 if I have this model, created in a fresh project with no non-default settings (other than 'MEDIA_ROOT' set to a directory and a single app in INSTALLED_APPS with this model):


{{{
class SomeModel(models.Model):
    fd = models.FileField()
}}}

Then I run this in `manage.py shell`:

{{{
>>> s = SomeModel.objects.create(fd='test.txt')
>>> s.fd.size
5
>>> s.fd.closed
True
>>> s.fd.open('r')
>>> s.fd.read()
b'hello'
>>> s.fd.close()
>>> s.fd.open('r')
>>> s.fd.read()
'hello'
}}}

The first time a `FileField` is opened it appears to disregard the encoding given and always returns bytes. However the second time it correctly returns a string. If you re-fetch the model then the behavior happens again.

Just to mention that I'm on Linux, but my co-worker is on Windows and both appear to have this behavior."	Bug	closed	File uploads/storage	1.10	Normal	duplicate			Unreviewed	0	0	0	0	0	0
