Python Forum
Letters with Accents Not Displaying
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Letters with Accents Not Displaying
#1
My Python 2.7.10 code (in MacOS 10.14.5) replaces letters with accents such as á with strings such as \xc3\xa1. Letters display with accents in both my text file (in TextEdit) of Portuguese words and my (Mac) Terminal, both of which are encoded in Unicode (UTF-8). I've searched online and tried various things but nothing works.

This is my code:

f = open(filename,"r")
filelist = list(f)
n = filename + "_As_List"
l = open(n,"w")
print(filelist)
l.write(str(filelist))
How can I get letters with accents to display in the outputs of that code?
Reply


Messages In This Thread
Letters with Accents Not Displaying - by Phylus - Jun-11-2019, 05:03 PM
RE: Letters with Accents Not Displaying - by nilamo - Jun-11-2019, 06:17 PM
RE: Letters with Accents Not Displaying - by Phylus - Jun-11-2019, 06:33 PM
RE: Letters with Accents Not Displaying - by nilamo - Jun-11-2019, 06:38 PM
RE: Letters with Accents Not Displaying - by Phylus - Jun-11-2019, 06:50 PM
RE: Letters with Accents Not Displaying - by Phylus - Jun-12-2019, 05:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] [Windows] Fails reading strings with accents Winfried 1 1,479 Apr-23-2023, 05:27 PM
Last Post: Larz60+
  Letters with Accents Not Inputting Phylus 0 1,850 Jun-12-2019, 04:05 PM
Last Post: Phylus

Forum Jump:

User Panel Messages

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