How do I encode a UTF-8 file on Mac Method 4 Open the file with Emacs. Click the Opening files pop-up menu (under Plain Text File Encoding) and choose an encoding. So typing export PYTHONIOENCODINGutf-8 prior to invoking the Python interpreter does the trick, or you could. Choose a different encoding for all documents In the TextEdit app on your Mac, choose TextEdit > Preferences, then click Open and Save. utf-8 or latin-1 the optional errorhandler part specifies what to do with characters that can't be handled by the encoding, and should be one of 'error', 'ignore', or 'replace'. That worked for me because the txt was created and written firstly in windows. The encoding part specifies the encoding's name, e.g. In the Plain Text file encoding choose 'Opening files - Greek Windows'. Go to the Textedit preferences, click on Open and Save tab. text.txt: text/plain charsetunknown-8bit With text/plain being the file type and unknown-8bit being the character set file encoding. Go to File -> Save As and choose UTF-8 under Encoding, press Save and overwrite existing file. You dont have to open first the textedit app.Open it, and do NOT type anything into it.Similarly, how do I change encoding in Notepad?
A few DOS code pages can be converted to Unix Latin-1. Besides line breaks Dos2unix can also convert the encoding of files.
Nowadays Mac OS uses Unix style (LF) line breaks. In Mac text files, prior to Mac OS X, a line break was single Carriage Return (CR) character.
Right click on Desktop, then choose New > Text Document.