Hello I want to have a plaintext version of my content available. So I have a separate template for that. I am calling render_to_response with mimetype="text/plain" but i want to tell a browser opening that page in the http-response that the content is utf-8 encoded. How do i do that (e.g. what do i have to add to render_to_response)?
sending content-encoding header in django
9.5k Views Asked by niklasfi At
1
There are 1 best solutions below
Related Questions in DJANGO
- Display images on Django Template Site
- Protractor did not run properly when using browser.wait, msg: "Wait timed out after XXXms"
- Django invalid literal for int() with base 10:
- Removing URL features from tokens in NLTK
- Django Noob URL to from Root Page to sub Page
- Django Admin tables not displaying correctly
- Django with chartkick
- Django urls.py not rendering correct template
- django form errors before submit
- django admin: custom app_index with context
- Display multiple models in one view in Django
- Unexpected NoReverseMatch error when using include() in urls patterns
- Search for a key in django.core.cache
- Django webapp (on an Apache2 server) hangs indefintely when importing nltk in views.py
- Django flush won't load fixtures
Related Questions in HTTPRESPONSE
- How to get response from server every second in JSON?
- How to loop and get the specific value of the json object ,how can i use that json object to get the other entity present in that json object?
- How to call HttpResponse from external function?
- HttpResponseMessage.Content as an attachment for an email
- What is the correct way to return a specialized HTTP response?
- Handle http request that has timedout while in reality request was processed by server successefully
- Downloaded octet-stream then encoding as pdf; can't get line endings worked out
- Missing last 8 bytes of file when downloading from HTTPS
- AttributeError: 'HTTPResponse' object has no attribute 'replace'
- Is there any way to know whether the parent window is closed or not in django view?
- Django get a DOM object from an HttpResponse
- How to specify 1 to many and many to 1 relations in json-ld document?
- Unpredictable results when sending HTTP POST using DefaultHttpClient
- passing argument from one function to request.on nodejs
- Spring MV 3.2 Exception Response Mapping
Related Questions in CONTENT-ENCODING
- PHP ob_gzhandler, setting Content-Length disables gzipped output
- Why doesn't apache java http library handle sites with Content-Encoding: none?
- Accept-Encoding:gzip and Content-Encoding:gzip
- How to use gzip Content-Encoding in plain text upload?
- how-to convert encoding with node.js feedparser for rss-feeds
- PHP ob_start() and ob_start('ob_gzhandler')
- setting a Content-Type in CakePHP when the response is large-ish (>4kB)
- In which RFC is =xx notation defined?
- Content-Transfer-Encoding: quoted-printable is breaks the break lines
- How do I differentiate between request and response in an HTTPURLConnection?
- Does internet Explorer 7 honour the Vary header by caching properly?
- Does a GunzipOutputStream - or something like it - exist?
- How to set content Encoding in HTML file
- TIKA - Compute Content-Encoding of a document
- http: minimum content-encoding support for clients?
Related Questions in RENDER-TO-RESPONSE
- Django render_to_response not working as expected
- django render_to_response how to send special characters
- UnicodeDecodeError: 'ascii' codec can't decode error when using render_to_response and dajax.assign
- django - iterating over return render_to_response
- alternative to {% if request.user.is_active %} in Django Templates
- Django-cms render_to_response doesn't render to template
- sending content-encoding header in django
- Django: Multiple Content-Type: text/html appears on html page
- Django Form Wizard Render to Response on Step
- Scope of dictionary passed in render_to_response
- Django throws error 'WSGIRequest' object has no attribute 'push'
- Django code to open sepecific tab in render_to_response in view
- Django - CSRF Token generation - render_to_response vs render
- render to response is not work for jquery ajax request
- render_to_response with HTTP response headers
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Just add charset to mimetype like this:
What really happens behind scene is that mimetype is taken out of kwargs in
render_to_response.and sent to
HttpResponsewhich sets it ascontent_type: