Fix typos
This commit is contained in:
parent
f694456ff6
commit
31d359694a
2 changed files with 7 additions and 8 deletions
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 21cf07433147212ee6c8ab203dfa648a9239c66f
|
|
||||||
|
|
@ -8,7 +8,7 @@ should probably read `The Absolute Minimum Every Software Developer
|
||||||
Absolutely, Positively Must Know About Unicode and Character Sets
|
Absolutely, Positively Must Know About Unicode and Character Sets
|
||||||
<http://www.joelonsoftware.com/articles/Unicode.html>`_. This part of the
|
<http://www.joelonsoftware.com/articles/Unicode.html>`_. This part of the
|
||||||
documentation just tries to cover the very basics so that you have a
|
documentation just tries to cover the very basics so that you have a
|
||||||
pleasent experience with unicode related things.
|
pleasant experience with unicode related things.
|
||||||
|
|
||||||
Automatic Conversion
|
Automatic Conversion
|
||||||
--------------------
|
--------------------
|
||||||
|
|
@ -54,7 +54,7 @@ unicode. What does working with unicode in Python 2.x mean?
|
||||||
UTF-8 for this purpose. To tell the interpreter your encoding you can
|
UTF-8 for this purpose. To tell the interpreter your encoding you can
|
||||||
put the ``# -*- coding: utf-8 -*-`` into the first or second line of
|
put the ``# -*- coding: utf-8 -*-`` into the first or second line of
|
||||||
your Python source file.
|
your Python source file.
|
||||||
- Jinja is configured to decode the template files from UTF08. So make
|
- Jinja is configured to decode the template files from UTF-8. So make
|
||||||
sure to tell your editor to save the file as UTF-8 there as well.
|
sure to tell your editor to save the file as UTF-8 there as well.
|
||||||
|
|
||||||
Encoding and Decoding Yourself
|
Encoding and Decoding Yourself
|
||||||
|
|
@ -63,12 +63,12 @@ Encoding and Decoding Yourself
|
||||||
If you are talking with a filesystem or something that is not really based
|
If you are talking with a filesystem or something that is not really based
|
||||||
on unicode you will have to ensure that you decode properly when working
|
on unicode you will have to ensure that you decode properly when working
|
||||||
with unicode interface. So for example if you want to load a file on the
|
with unicode interface. So for example if you want to load a file on the
|
||||||
filesystem and embedd it into a Jinja2 template you will have to decode it
|
filesystem and embed it into a Jinja2 template you will have to decode it
|
||||||
form the encoding of that file. Here the old problem that textfiles do
|
from the encoding of that file. Here the old problem that text files do
|
||||||
not specify their encoding comes into play. So do yourself a favour and
|
not specify their encoding comes into play. So do yourself a favour and
|
||||||
limit yourself to UTF-8 for textfiles as well.
|
limit yourself to UTF-8 for text files as well.
|
||||||
|
|
||||||
Anyways. To load such a file with unicode you can use the builtin
|
Anyways. To load such a file with unicode you can use the built-in
|
||||||
:meth:`str.decode` method::
|
:meth:`str.decode` method::
|
||||||
|
|
||||||
def read_file(filename, charset='utf-8'):
|
def read_file(filename, charset='utf-8'):
|
||||||
|
|
@ -104,4 +104,4 @@ set your editor to store as UTF-8:
|
||||||
3. Select "UTF-8 without BOM" as encoding
|
3. Select "UTF-8 without BOM" as encoding
|
||||||
|
|
||||||
It is also recommended to use the Unix newline format, you can select
|
It is also recommended to use the Unix newline format, you can select
|
||||||
it in the same panel but this not a requirement.
|
it in the same panel but this is not a requirement.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue