On Sun, 13 Dec 2015 13:17:24 +0100
Laura Creighton wrote:
> In a message of Sun, 13 Dec 2015 01:35:45 -0500, "D'Arcy J.M. Cain"
> writes:
> >When I try to print it to the web page it fails because the \xe9
> >character is not valid ASCII. However, my default encoding is utf-8.
> >Other web pages
In a message of Sun, 13 Dec 2015 01:35:45 -0500, "D'Arcy J.M. Cain" writes:
>When I try to print it to the web page it fails because the \xe9
>character is not valid ASCII. However, my default encoding is utf-8.
>Other web pages on the same server display fine.
>
>I have the following in the Apach
D'Arcy J.M. Cain wrote:
> On Sat, 12 Dec 2015 21:35:36 +0100
> Peter Otten <__pete...@web.de> wrote:
>> def read_file(filename):
>> for encoding in ["utf-8", "iso-8859-1"]:
>> try:
>> with open(filename, encoding=encoding) as f:
>> return f.read()
>>
On Sat, 12 Dec 2015 21:35:36 +0100
Peter Otten <__pete...@web.de> wrote:
> def read_file(filename):
> for encoding in ["utf-8", "iso-8859-1"]:
> try:
> with open(filename, encoding=encoding) as f:
> return f.read()
> except UnicodeDecodeError:
>
D'Arcy J.M. Cain wrote:
> More Unicode bafflement. What I am trying to do is pretty simple I
> think. I have a bunch of files that I am pretty sure are either utf-8
> or iso-8859-1. I try utf-8 and fall back to iso-8859-1 if it throws a
> UnicodeError. Here is my test.
>
> #! /usr/pkg/bin/pyt
More Unicode bafflement. What I am trying to do is pretty simple I
think. I have a bunch of files that I am pretty sure are either utf-8
or iso-8859-1. I try utf-8 and fall back to iso-8859-1 if it throws a
UnicodeError. Here is my test.
#! /usr/pkg/bin/python3.4
# Running on a NetBSD 7.0 serv