“If this mixin is mixed into a request class it will provide
a dynamic charset attribute. This means that if the charset is
transmitted in the content type headers it’s used from there.

Because it changes the behavior or Request this class has
to be mixed in before the actual request class:

classMyRequest(DynamicCharsetRequestMixin,Request):pass

By default the request object assumes that the URL charset is the
same as the data charset. If the charset varies on each request
based on the transmitted data it’s not a good idea to let the URLs
change based on that. Most browsers assume either utf-8 or latin1
for the URLs if they have troubles figuring out. It’s strongly
recommended to set the URL charset to utf-8:

the default charset that is assumed if the content type header
is missing or does not contain a charset parameter. The default
is latin1 which is what HTTP specifies as default charset.
You may however want to set this to utf-8 to better support
browsers that do not transmit a charset for incoming data.

If this mixin is mixed into a response class it will provide
a dynamic charset attribute. This means that if the charset is
looked up and stored in the Content-Type header and updates
itself automatically. This also means a small performance hit but
can be useful if you’re working with different charsets on
responses.

Because the charset attribute is no a property at class-level, the
default value is stored in default_charset.

Because it changes the behavior or Response this class has
to be mixed in before the actual response class: