Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5531
| From | Hermann Riemann <nospam.ng@hermann-riemann.de> |
|---|---|
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] python2 --> python3 : str vs bytes |
| Date | 2019-08-26 07:03 +0200 |
| Message-ID | <gsh7hvFjh3tU1@mid.individual.net> (permalink) |
| References | <qjtf7q$p8s$1@news2.informatik.uni-stuttgart.de> <07330df3-6eec-a92c-40c5-71634b718f33@behnel.de> <mailman.41.1566723043.30344.python-de@python.org> |
Am 25.08.19 um 10:44 schrieb Stefan Behnel:
> Das Dekodieren erledigt Python (3) oft auch automatisch, z.B. wenn du von
> stdin oder aus einer UTF8-Textdatei (oder JSON/XML/...) liest. Alles andere
> musst du aber explizit einstellen, z.B. bei "open()" mit der "encoding=..."
> Option.
Stimmt nicht ganz. Das kann von den Einstellungen im Betriebssystem
abhängen.
So hat utf in cgi in SuSE ohne
sys.stdout=codecs.open("/dev/stdout","w","utf8")
nicht funktioniert, wohingegen raspberry pi
diese Zeile für einen Fehler hält.
Hermann
der auch schon mit Dateien Probleme hatte,
die sowohl utf8 als auch ISO Werte enthielten.
--
http://www.hermann-riemann.de
Back to de.comp.lang.python | Previous | Next — Previous in thread | Find similar
python2 --> python3 : str vs bytes Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2019-08-25 08:00 +0000
Re: python2 --> python3 : str vs bytes Hermann Riemann <nospam.ng@hermann-riemann.de> - 2019-08-25 10:20 +0200
Re: [Python-de] python2 --> python3 : str vs bytes Stefan Behnel <python-de@behnel.de> - 2019-08-25 10:44 +0200
Re: [Python-de] python2 --> python3 : str vs bytes Hermann Riemann <nospam.ng@hermann-riemann.de> - 2019-08-26 07:03 +0200
csiph-web