HTTP/2 302
server: nginx
date: Thu, 17 Jul 2025 13:05:58 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20091216095523
location: https://web.archive.org/web/20091216095523/https://wiki.python.org/moin/DefaultEncoding
server-timing: captures_list;dur=0.481410, exclusion.robots;dur=0.015547, exclusion.robots.policy;dur=0.007873, esindex;dur=0.010215, cdx.remote;dur=51.654894, LoadShardBlock;dur=394.101234, PetaboxLoader3.resolve;dur=171.434084, PetaboxLoader3.datanode;dur=171.879226
x-app-server: wwwb-app203
x-ts: 302
x-tr: 477
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: SERVER=wwwb-app203; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Thu, 17 Jul 2025 13:05:59 GMT
content-type: text/html; charset=utf-8
x-archive-orig-date: Wed, 16 Dec 2009 09:55:22 GMT
x-archive-orig-server: Apache/2.2.9 (Debian) mod_fastcgi/2.4.6 mod_python/3.3.1 Python/2.5.2 mod_wsgi/2.5
x-archive-orig-vary: Cookie,User-Agent,Accept-Language
x-archive-orig-content-length: 9872
x-archive-orig-connection: close
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Wed, 16 Dec 2009 09:55:23 GMT
link:
; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Mon, 11 Sep 2006 05:35:45 GMT", ; rel="prev memento"; datetime="Sat, 27 Jun 2009 08:04:22 GMT", ; rel="memento"; datetime="Wed, 16 Dec 2009 09:55:23 GMT", ; rel="next memento"; datetime="Tue, 28 Dec 2010 03:45:47 GMT", ; rel="last memento"; datetime="Fri, 25 Apr 2025 03:05:52 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 51_13_20091216090121_crawl102-c/51_13_20091216095243_crawl103.arc.gz
server-timing: captures_list;dur=0.944484, exclusion.robots;dur=0.035860, exclusion.robots.policy;dur=0.017492, esindex;dur=0.023650, cdx.remote;dur=114.252876, LoadShardBlock;dur=626.778698, PetaboxLoader3.datanode;dur=100.289287, PetaboxLoader3.resolve;dur=564.066248, load_resource;dur=144.374453
x-app-server: wwwb-app203
x-ts: 200
x-tr: 948
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
DefaultEncoding - PythonInfo Wiki
Python users who are new to Unicode sometimes are attracted by default encoding returned by sys.getdefaultencoding(). The first thing you should know about default encoding is that you don't need to care about it. Its value should be 'ascii' and it is used when converting byte strings StrIsNotAString to unicode strings. As in this example:
When you concatenate byte string "abc" with unicode string u"bcd" Python will first convert "abc" into u"abc" by calling "abc".decode(sys.getdefaultencoding()). If you put non-ascii characters into byte string then .decode(sys.getdefaultencoding()) method will fail with UnicodeDecodeError , therefore byte strings should not contain non-ascii characters. In Python3.0 sys.getdefaultencoding will be removed.
CategoryUnicode
EditText (last edited 2008-11-15 14:00:50 by localhost )