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
6c9dcda6
Kaydet (Commit)
6c9dcda6
authored
Ara 17, 2016
tarafından
Xavier de Gaye
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #28596: The preferred encoding is UTF-8 on Android.
üst
b06cde61
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
14 deletions
+29
-14
_bootlocale.py
Lib/_bootlocale.py
+11
-5
locale.py
Lib/locale.py
+15
-9
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/_bootlocale.py
Dosyayı görüntüle @
6c9dcda6
...
...
@@ -14,11 +14,17 @@ else:
try
:
_locale
.
CODESET
except
AttributeError
:
def
getpreferredencoding
(
do_setlocale
=
True
):
# This path for legacy systems needs the more complex
# getdefaultlocale() function, import the full locale module.
import
locale
return
locale
.
getpreferredencoding
(
do_setlocale
)
if
hasattr
(
sys
,
'getandroidapilevel'
):
# On Android langinfo.h and CODESET are missing, and UTF-8 is
# always used in mbstowcs() and wcstombs().
def
getpreferredencoding
(
do_setlocale
=
True
):
return
'UTF-8'
else
:
def
getpreferredencoding
(
do_setlocale
=
True
):
# This path for legacy systems needs the more complex
# getdefaultlocale() function, import the full locale module.
import
locale
return
locale
.
getpreferredencoding
(
do_setlocale
)
else
:
def
getpreferredencoding
(
do_setlocale
=
True
):
assert
not
do_setlocale
...
...
Lib/locale.py
Dosyayı görüntüle @
6c9dcda6
...
...
@@ -618,15 +618,21 @@ else:
try
:
CODESET
except
NameError
:
# Fall back to parsing environment variables :-(
def
getpreferredencoding
(
do_setlocale
=
True
):
"""Return the charset that the user is likely using,
by looking at environment variables."""
res
=
getdefaultlocale
()[
1
]
if
res
is
None
:
# LANG not set, default conservatively to ASCII
res
=
'ascii'
return
res
if
hasattr
(
sys
,
'getandroidapilevel'
):
# On Android langinfo.h and CODESET are missing, and UTF-8 is
# always used in mbstowcs() and wcstombs().
def
getpreferredencoding
(
do_setlocale
=
True
):
return
'UTF-8'
else
:
# Fall back to parsing environment variables :-(
def
getpreferredencoding
(
do_setlocale
=
True
):
"""Return the charset that the user is likely using,
by looking at environment variables."""
res
=
getdefaultlocale
()[
1
]
if
res
is
None
:
# LANG not set, default conservatively to ASCII
res
=
'ascii'
return
res
else
:
def
getpreferredencoding
(
do_setlocale
=
True
):
"""Return the charset that the user is likely using,
...
...
Misc/NEWS
Dosyayı görüntüle @
6c9dcda6
...
...
@@ -13,6 +13,9 @@ Core and Builtins
- Issue #18896: Python function can now have more than 255 parameters.
collections.namedtuple() now supports tuples with more than 255 elements.
- Issue #28596: The preferred encoding is UTF-8 on Android. Patch written by
Chi Hsuan Yen.
- Issue #26919: On Android, operating system data is now always encoded/decoded
to/from UTF-8, instead of the locale encoding to avoid inconsistencies with
os.fsencode() and os.fsdecode() which are already using UTF-8.
...
...
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