Re: [Tutor] output not in ANSI, conversing char set to locale.getpreferredencoding()

2012-08-14 Thread Walter Prins
Hi Leon, Since Unicode's been pulled into the discussion, I'd like to suggest you watch and read the following presentation "Pragmatic Unicode ~or~ How do I stop the pain?" from Pycon US 2012: http://nedbatchelder.com/text/unipain.html Walter ___ Tutor

Re: [Tutor] output not in ANSI, conversing char set to locale.getpreferredencoding()

2012-08-14 Thread eryksun
On Tue, Aug 14, 2012 at 10:03 AM, Peter Otten <__pete...@web.de> wrote: > > You have to find out the database encoding The character at 7 is 'ë', which is '\xc3\xab' in UTF-8. So that's likely the db encoding. > As you now have a bytestring again you can forget about codecs.open() which > won't w

Re: [Tutor] output not in ANSI, conversing char set to locale.getpreferredencoding()

2012-08-14 Thread Peter Otten
leon zaat wrote: > I get the error: > UnicodeDecodeError: 'ascii' codecs can't decode byte 0xc3 in position 7: > ordinal not in range(128) for the openbareruimtenaam=u'' + > (openbareruimtenaam1.encode(chartype)) line. The error message means that database.select() returns a byte string. bytest

Re: [Tutor] output not in ANSI, conversing char set to locale.getpreferredencoding()

2012-08-14 Thread leon zaat
> From: eryk...@gmail.com > Date: Mon, 13 Aug 2012 15:12:04 -0400 > To: joel.goldst...@gmail.com > CC: alan.ga...@btinternet.com; tutor@python.org > Subject: Re: [Tutor] output not in ANSI > > On Mon, Aug 13, 2012 at 2:04 PM, Joel Goldstick > wrote: > > > &

Re: [Tutor] output not in ANSI

2012-08-13 Thread Steven D'Aprano
On 14/08/12 04:04, Joel Goldstick wrote: On Mon, Aug 13, 2012 at 1:58 PM, Alan Gauld wrote: On 13/08/12 16:01, leon zaat wrote: I wrote a program for creating a csv file. I am using pyton on windows. The output i get is not in ANSI. Can you clarify what you mean by ANSI? According to Wikip

Re: [Tutor] output not in ANSI

2012-08-13 Thread Alan Gauld
On 13/08/12 18:58, Alan Gauld wrote: Locale will affect the display of the data in terms of fonts and such. Is that what you are trying to control? For font read character set, oops! :-( -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ __

Re: [Tutor] output not in ANSI

2012-08-13 Thread Walter Prins
On 13 August 2012 20:12, eryksun wrote: > In Windows, ANSI refers to the locale-dependent 8-bit codepage. But > there is no ANSI standard for Windows1252. It's a common misnomer in > the OS dialog boxes and controls. Yes. In case it adds anything to the discussion, here's a page that documents t

Re: [Tutor] output not in ANSI

2012-08-13 Thread eryksun
On Mon, Aug 13, 2012 at 2:04 PM, Joel Goldstick wrote: > > I believe in this context the OP means ASCII. ASCII became an ANSI > recognized standard many years ago In Windows, ANSI refers to the locale-dependent 8-bit codepage. But there is no ANSI standard for Windows1252. It's a common misnomer

Re: [Tutor] output not in ANSI

2012-08-13 Thread Jerry Hill
On Mon, Aug 13, 2012 at 11:01 AM, leon zaat wrote: > I wrote a program for creating a csv file. > I am using pyton on windows. > The output i get is not in ANSI. I'm not familiar with an encoding that would be called ANSI, or any ANSI specification for CSV files. What, exactly, are you looking f

Re: [Tutor] output not in ANSI

2012-08-13 Thread Joel Goldstick
On Mon, Aug 13, 2012 at 1:58 PM, Alan Gauld wrote: > On 13/08/12 16:01, leon zaat wrote: >> >> I wrote a program for creating a csv file. >> I am using pyton on windows. >> The output i get is not in ANSI. > > > Can you clarify what you mean by ANSI? According to Wikipedia: > I believe in this con

Re: [Tutor] output not in ANSI

2012-08-13 Thread Alan Gauld
On 13/08/12 16:01, leon zaat wrote: I wrote a program for creating a csv file. I am using pyton on windows. The output i get is not in ANSI. Can you clarify what you mean by ANSI? According to Wikipedia: The Institute administers five standards panels: The ANSI Biofuels St

[Tutor] output not in ANSI

2012-08-13 Thread leon zaat
I wrote a program for creating a csv file. I am using pyton on windows. The output i get is not in ANSI. Is there a way i can get the output in ansi, I imported locale and tried wb and w as type of writing. ofile=open(r'D:\bestanden\BAG\adrescoordinaten.csv', 'w(b)')