Apr-23-2021, 01:44 PM
(Apr-17-2021, 07:24 PM)snippsat Wrote: Doprint(repr(strLeagueName))
If get this it should work,if not try run from command line and not use Ide/editor.
>>> print(repr(strLeagueName)) '1a Divisió'johnboy1974 Wrote:Very odd. I'm running python 3.65 so not sure if that's the issue? I'm reluctant to upgrade as always a bit nervous. Reckon I should?Yes should upgrade.
Hi mate,
Apologies for such a late reply. I fell ill and just come back to life(ish). Righty-o, I've upgraded to latest python and also the latest version of PyCharm... Thanks again for your reply!! I've done some more testing and I'm seriously lost with this... It's an odd one.
Firstly, running from the command line produced the same results. Now for the weird part...
1) When I use 'encoding='utf-8' and have f = open(strTablesFile, 'a', encoding='utf-8'). I get the following:
Butrinti Sarandë gets written as Butrinti Sarandë
Qarabağ gets written as Qarabag
2) When I leave out the encoding and have: f = open(strTablesFile, 'a'). I get the following:
Butrinti Sarandë gets written as Butrinti Sarandë --> Works!!
Qarabağ gets written as UnicodeEncodeError: 'charmap' codec can't encode character '\u0131' in position 6: character maps to <undefined> --> Crashes. When I stick it in a try statement and print the string to the console, it prints as I'd expect it to:
So it's a bit of a mixed bag really and now I'm properly lost!! Qarabağ
Cheers!