Skip to content
Myr

Fix typos

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by florentx · committed by Armin Ronacher · parent f694456 · Browse files · 2 files+7 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−7 removed

  • other:+7 added−7 removed

2 files+7 added−7 removed

deleted:docs/_themesnot shown

Its text is not shown, deleted.

modified:docs/unicode.rst+7 added-7 removed
6 unmodified lines
7should probably read `The Absolute Minimum Every Software Developer8Absolutely, Positively Must Know About Unicode and Character Sets9<http://www.joelonsoftware.com/articles/Unicode.html>`_. This part of the10documentation just tries to cover the very basics so that you have a11pleasent experience with unicode related things.11pleasant experience with unicode related things.1213Automatic Conversion14--------------------15
37 unmodified lines
53 to tell Python which encoding your file uses. Again, I recommend54 UTF-8 for this purpose. To tell the interpreter your encoding you can55 put the ``# -*- coding: utf-8 -*-`` into the first or second line of56 your Python source file.57- Jinja is configured to decode the template files from UTF08. So make57- Jinja is configured to decode the template files from UTF-8. So make58 sure to tell your editor to save the file as UTF-8 there as well.5960Encoding and Decoding Yourself61------------------------------6263If you are talking with a filesystem or something that is not really based64on unicode you will have to ensure that you decode properly when working65with unicode interface. So for example if you want to load a file on the66filesystem and embedd it into a Jinja2 template you will have to decode it67form the encoding of that file. Here the old problem that textfiles do66filesystem and embed it into a Jinja2 template you will have to decode it67from the encoding of that file. Here the old problem that text files do68not specify their encoding comes into play. So do yourself a favour and69limit yourself to UTF-8 for textfiles as well.69limit yourself to UTF-8 for text files as well.7071Anyways. To load such a file with unicode you can use the builtin71Anyways. To load such a file with unicode you can use the built-in72:meth:`str.decode` method::7374 def read_file(filename, charset='utf-8'):75 with open(filename, 'r') as f:
27 unmodified lines
103 2. Select the "New Document/Default Directory" tab104 3. Select "UTF-8 without BOM" as encoding105106 It is also recommended to use the Unix newline format, you can select107 it in the same panel but this not a requirement.107 it in the same panel but this is not a requirement.