Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
7928f388
Kaydet (Commit)
7928f388
authored
Haz 28, 2003
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Explain source encodings. Fixes #683486.
üst
ab1e5858
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
tut.tex
Doc/tut/tut.tex
+33
-0
No files found.
Doc/tut/tut.tex
Dosyayı görüntüle @
7928f388
...
@@ -303,6 +303,39 @@ beginning of the script and giving the file an executable mode. The
...
@@ -303,6 +303,39 @@ beginning of the script and giving the file an executable mode. The
the hash, or pound, character,
\character
{
\#
}
, is used to start a
the hash, or pound, character,
\character
{
\#
}
, is used to start a
comment in Python.
comment in Python.
\subsection
{
Source Code Encoding
}
It is possible to use encodings different than ASCII in Python source
files. The best way to do it is to put one more special comment line
right after
\code
{
#!
}
line making proper encoding declaration:
\begin{verbatim}
# -*- coding: iso-8859-1 -*-
\end{verbatim}
With that declaration, all characters in the source file will be
treated as belonging to
\code
{
iso-8859-1
}
encoding, and it will be
possible to directly write Unicode string literals in the selected
encoding. The list of possible encodings can be found in the
\citetitle
[../lib/lib.html]
{
Python Library Reference
}
, in the section
on
\module
{
codecs
}
.
If your editor supports saving files as
\code
{
UTF-8
}
with an UTF-8
signature (aka BOM -- Byte Order Mark), you can use that instead of an
encoding declaration. IDLE supports such saving if
\code
{
Options/General/Default Source Encoding/UTF-8
}
is set. Notice
that this signature is not understood in older Python releases (2.2
and earlier), and also not understood by the operating system for
\code
{
#!
}
files.
By using UTF-8 (either through the signature, or a an encoding
declaration), characters of most languages in the world can be used
simultaneously in string literals and comments. Using non-ASCII
characters in identifiers is not supported. To display all these
characters properly, your editor must recognize that the file is
UTF-8, and it must use a font that supports all the characters in the
file.
\subsection
{
The Interactive Startup File
\label
{
startup
}}
\subsection
{
The Interactive Startup File
\label
{
startup
}}
% XXX This should probably be dumped in an appendix, since most people
% XXX This should probably be dumped in an appendix, since most people
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment