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 answers
Related Questions in DJANGO
- Django Admin Panel and Sub URLs Returning 404 Error on Deployment
- How to return HTTP Get request response from models class in Django project
- Issue with Quantity Increment in Django E-commerce Cart
- Can't install Pipenv on Windows
- use dict from python in django html template and also in js
- 'pyodbc.Cursor' object has no attribute 'callproc', mssql with django
- Django socketio process
- Root path analogue in uWSGI as in Uvicorn
- Django - ModuleNotFoundError: No module named 'backend'
- Does Python being a loosely typed programming language make it less secure?
- sorl-thumbnail adds a background color when padding is used
- Can't connect to local postgresql server from my docker container
- Why ProductHunt api dont work with Python?
- why i have to put extra space in before write option selected because it show error if i don't ' option:selected'
- Django Arrayfield migration to cloud sql (Postgresql) not creating the column
Related Questions in HTTPRESPONSE
- .NET httpserver. Get handle new request in current request handler
- Execute rest of the code after Response.End() Alternative?
- Why scrapy shell did not return an output?
- Set response code for compile errors in PHP
- How to ignore null properties in HttpApplication json response in .Net Framework
- What should HTTP 201 response body be when responding to a POST request with large data?
- In C# HttpResponse, when does the response stream starts to be sent to the client?
- Axios Interceptor always return 403 on Post Requests
- Stream content from SQL/DAO to Browser in a File using Spring
- Send a downloadable CSV as response in Next.js
- How to check if Response A has the same content as Response B in the browser?
- MacOS fails to get the file name from download response in ASP. NET Core
- Switchere s2s API Call returns error 404 no matter what I send
- Decoding JSON data from HttpWriter response data that comes compressed or has extra information
- PHP file_get_contents how to get <pre> content
Related Questions in CONTENT-ENCODING
- Gzip compression for HTML form upload?
- HTTP header for decompressed length
- spring boot response encoding not working
- Content Encoding Error but only for the first time when you visit the page on Drupal
- Ordering of multiple values in content-encoding header in http request
- Unable to get Content Encoding using PHP cURL
- Content-encoding in the Header of index page of Apache 2.4
- CloudFront decompress objects for viewers that don't support compression
- Options to be used with zlib module in Node.js to compress javascript files to be used with gzip encoding in browser
- contentEncodingError when opening website in Firefox using selenium and python3
- Does content encoding only compress for transmission, or also for persistent storage in S3?
- Why Facebook debugger raise: The crawler accepts deflate and gzip content encodings
- How to get Chrome to show bytes or time remaining for content-encoded downloads
- Unable to parse build.framework.js.br
- Is Gzip compressed binary data or uncompressed text safe to transmit over https, or should it be base 64 encoded as the final step before sending it?
Related Questions in RENDER-TO-RESPONSE
- render to response is not work for jquery ajax request
- Django Form Wizard Render to Response on Step
- How can I return html code by using `render_to_response`?
- Django - CSRF Token generation - render_to_response vs render
- {{ request }} var Empty
- How to return multiple arrays in Django
- How can i handle render_to_response with ajax, so that the page could be redirected with the content?
- Django-cms render_to_response doesn't render to template
- Django template can display array but not loop through it
- Django pass render_to_response template in other template
- Django: can "double" 'render_to_response' be unified into only one view?
- Django: Can I redirect with a data attachment to another page that was created by render_to_response with RequestContext?
- Django code to open sepecific tab in render_to_response in view
- Django throws error 'WSGIRequest' object has no attribute 'push'
- Scope of dictionary passed in render_to_response
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?
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)
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: