Postscript ...
Just went back into the csv file and it had switched *itself* back to
utf-16. This does not compute. I need to lift my understanding somewhat.
Mike
On 16/08/2016 6:35 PM, Mike Dewhirst wrote:
On 16/08/2016 5:36 PM, William ML Leslie wrote:
​What does something like this do for you?​
That is an official, gold plated win!
Thanks for your persistence William. Everything is utf-8 now. I found
a Windows registry hack to convert the codepage to utf-8 or actually
cp65001 as Microsoft prefer to call it. No more cp850 or cp1252. Then
I adjusted your ...
with open(csvfile, "r", encoding='utf-16') as csv:
... to utf-8 and we have readable output. I'm cooking again.
Apart from beer next time we meet and a glowing credit in the project
contribution list you have my sincere gratitude.
Fantastic
Mike
with open(csvfile, "r", encoding='utf-16') as csv:
   self.rows = csv.readlines()
   for
​i, ​
line in
​enumerate(​
self.rows
​)​
:
       cells = line.split(",")
       if i >= start:
           print(', '.join(cells)
​.encode('cp1252', 'replace').decode('cp1252')​
)
       if i > finish:
           break
--
William Leslie
Notice:
Likely much of this email is, by the nature of copyright, covered
under copyright law. You absolutely MAY reproduce any part of it
in accordance with the copyright law of the nation you are reading
this in. Any attempt to DENY YOU THOSE RIGHTS would be illegal
without prior contractual agreement.
_______________________________________________
melbourne-pug mailing list
melbourne-pug@python.org
https://mail.python.org/mailman/listinfo/melbourne-pug
_______________________________________________
melbourne-pug mailing list
melbourne-pug@python.org
https://mail.python.org/mailman/listinfo/melbourne-pug
_______________________________________________
melbourne-pug mailing list
melbourne-pug@python.org
https://mail.python.org/mailman/listinfo/melbourne-pug