mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[4.0.x] Improved docs regarding UTF-8 support with Apache and mod_wsgi.
Backport of bf4be3711a from main
			
			
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							f2a59630f4
						
					
				
				
					commit
					fe97f8bb62
				
			| @@ -83,15 +83,21 @@ should put in this file, and what else you can add to it. | |||||||
|  |  | ||||||
| .. admonition:: Fixing ``UnicodeEncodeError`` for file uploads | .. admonition:: Fixing ``UnicodeEncodeError`` for file uploads | ||||||
|  |  | ||||||
|     If you get a ``UnicodeEncodeError`` when uploading files with file names |     If you get a ``UnicodeEncodeError`` when uploading or writing files with | ||||||
|     that contain non-ASCII characters, make sure Apache is configured to accept |     file names or content that contains non-ASCII characters, make sure Apache | ||||||
|     non-ASCII file names:: |     is configured to support UTF-8 encoding:: | ||||||
|  |  | ||||||
|         export LANG='en_US.UTF-8' |         export LANG='en_US.UTF-8' | ||||||
|         export LC_ALL='en_US.UTF-8' |         export LC_ALL='en_US.UTF-8' | ||||||
|  |  | ||||||
|     A common location to put this configuration is ``/etc/apache2/envvars``. |     A common location to put this configuration is ``/etc/apache2/envvars``. | ||||||
|  |  | ||||||
|  |     Alternatively, if you are :ref:`using mod_wsgi daemon mode<daemon-mode>` | ||||||
|  |     you can add ``lang`` and ``locale`` options to the ``WSGIDaemonProcess`` | ||||||
|  |     directive:: | ||||||
|  |  | ||||||
|  |         WSGIDaemonProcess example.com lang='en_US.UTF-8' locale='en_US.UTF-8' | ||||||
|  |  | ||||||
|     See the :ref:`unicode-files` section of the Unicode reference guide for |     See the :ref:`unicode-files` section of the Unicode reference guide for | ||||||
|     details. |     details. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -291,8 +291,8 @@ Files | |||||||
| If you intend to allow users to upload files, you must ensure that the | If you intend to allow users to upload files, you must ensure that the | ||||||
| environment used to run Django is configured to work with non-ASCII file names. | environment used to run Django is configured to work with non-ASCII file names. | ||||||
| If your environment isn't configured correctly, you'll encounter | If your environment isn't configured correctly, you'll encounter | ||||||
| ``UnicodeEncodeError`` exceptions when saving files with file names that | ``UnicodeEncodeError`` exceptions when saving files with file names or content | ||||||
| contain non-ASCII characters. | that contains non-ASCII characters. | ||||||
|  |  | ||||||
| Filesystem support for UTF-8 file names varies and might depend on the | Filesystem support for UTF-8 file names varies and might depend on the | ||||||
| environment. Check your current configuration in an interactive Python shell by | environment. Check your current configuration in an interactive Python shell by | ||||||
| @@ -306,7 +306,7 @@ This should output "UTF-8". | |||||||
| The ``LANG`` environment variable is responsible for setting the expected | The ``LANG`` environment variable is responsible for setting the expected | ||||||
| encoding on Unix platforms. Consult the documentation for your operating system | encoding on Unix platforms. Consult the documentation for your operating system | ||||||
| and application server for the appropriate syntax and location to set this | and application server for the appropriate syntax and location to set this | ||||||
| variable. | variable. See the :doc:`/howto/deployment/wsgi/modwsgi` for examples. | ||||||
|  |  | ||||||
| In your development environment, you might need to add a setting to your | In your development environment, you might need to add a setting to your | ||||||
| ``~.bashrc`` analogous to::: | ``~.bashrc`` analogous to::: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user