Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
More non english characters
#8
(Apr-17-2021, 07:24 PM)snippsat Wrote: Do print(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!
Reply


Messages In This Thread
More non english characters - by johnboy1974 - Apr-17-2021, 11:32 AM
RE: More non english characters - by snippsat - Apr-17-2021, 11:48 AM
RE: More non english characters - by johnboy1974 - Apr-17-2021, 03:13 PM
RE: More non english characters - by johnboy1974 - Apr-17-2021, 04:06 PM
RE: More non english characters - by snippsat - Apr-17-2021, 05:33 PM
RE: More non english characters - by johnboy1974 - Apr-17-2021, 05:52 PM
RE: More non english characters - by snippsat - Apr-17-2021, 07:24 PM
RE: More non english characters - by johnboy1974 - Apr-23-2021, 01:44 PM
RE: More non english characters - by snippsat - Apr-23-2021, 02:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  (python) Can i get some help fixing a English to Morse translator? Pls AlexPython 8 3,217 Dec-03-2024, 10:21 AM
Last Post: skylartyler
  write a program which prints the day in english ben1122 10 6,878 Jul-25-2021, 05:55 PM
Last Post: ben1122
  Remove escape characters / Unicode characters from string DreamingInsanity 5 21,703 May-15-2020, 01:37 PM
Last Post: snippsat
  English interpretation of the following file handing snippet mortch 5 4,264 May-30-2019, 08:10 AM
Last Post: mortch
  TreeTagger : parameter file invalid : english.par Raph0909 0 3,320 Apr-12-2019, 12:12 PM
Last Post: Raph0909
  Cobol code to English like language/Identify ENDIF for correspoding IF in a string Venkat 6 5,380 Apr-12-2018, 01:05 PM
Last Post: buran
  how coding microphone receive non-English? TedHanaka 1 2,891 Feb-12-2018, 02:13 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020