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
20eae69a
Kaydet (Commit)
20eae69a
authored
Eki 07, 2002
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Document PEP 293.
üst
bd5e38d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
whatsnew23.tex
Doc/whatsnew/whatsnew23.tex
+21
-1
No files found.
Doc/whatsnew/whatsnew23.tex
Dosyayı görüntüle @
20eae69a
...
...
@@ -492,7 +492,27 @@ strings \samp{True} and \samp{False} instead of \samp{1} and \samp{0}.
%======================================================================
\section
{
PEP 293: Codec Error Handling Callbacks
}
XXX write this section
When encoding a Unicode string into a byte string, unencodable
characters may be encountered. So far, Python allowed to specify the
error processing as either ``strict'' (raise
\code
{
UnicodeError
}
,
default), ``ignore'' (skip the character), or ``replace'' (with
question mark). It may be desirable to specify an alternative
processing of the error, e.g. by inserting an XML character reference
or HTML entity reference into the converted string.
Python now has a flexible framework to add additional processing
strategies; new error handlers can be added with
\function
{
codecs.register
_
error
}
. Codecs then can access the error
handler with
\code
{
codecs.lookup
_
error
}
. An equivalent C API has been
added for codecs written in C. The error handler gets various state
information, such as the string being converted, the position in the
string where the error was detected, and the target encoding. It can
then either raise an exception, or return a replacement string.
Two additional error handlers have been implemented using this
framework: ``backslashreplace'' using Python backslash quoting to
represent the unencodable character, and ``xmlcharrefreplace'' emits
XML character references.
\begin{seealso}
...
...
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