You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Mac OS. How can I find out the encoding of a text file through the user interface?

How can I find out the encoding of a text file through the user interface? Or is this feature not provided on Mac OS? Maybe there is some built-in program like "TextEdit" through which I can find out the encoding of a text file?

MacBook (2017)

Posted on Aug 10, 2023 11:57 AM

Reply
Question marked as Top-ranking reply

Posted on Aug 11, 2023 7:17 AM

What you want does not ship with macOS which is why BDAqua and I recommended the Terminal.


Your options:

  1. Use the Terminal solution I provided
  2. Write a short AppleScript that can provide the dialog shown below
  3. Find a third-party application compatible with your installed version of macOS'



The AppleScript to produce the above dialog was 5 lines of code, can be saved as an application, and as such, can be double-clicked in the Finder to run.

6 replies
Question marked as Top-ranking reply

Aug 11, 2023 7:17 AM in response to constantin245

What you want does not ship with macOS which is why BDAqua and I recommended the Terminal.


Your options:

  1. Use the Terminal solution I provided
  2. Write a short AppleScript that can provide the dialog shown below
  3. Find a third-party application compatible with your installed version of macOS'



The AppleScript to produce the above dialog was 5 lines of code, can be saved as an application, and as such, can be double-clicked in the Finder to run.

Aug 10, 2023 2:23 PM in response to constantin245

Terminal (where ~ is a shortcut for your home directory representing /Users/yourname):


file --mime-encoding /path/to/file


file --mime-encoding ~/apple.txt
apple.txt: utf-8

file --mime-encoiding ~/cicero.txt
cicero.txt: us-ascii

iconv -f US-ASCII -t UTF-16 ~/cicero.txt > ~/cicero16.txt
file --mime-encoding ~/cicero16.txt
cicero16.txt: utf-16be


Aug 11, 2023 7:27 AM in response to constantin245

In the Finder, one can right-click on any file, choose Get Info from the secondary menu, and the resulting panel will report the kind of file.


That panel will not report the actual encoding, but will report US-ASCII or UTF-8 files as Plain Text Documents, CSV as that, Word documents as Open Office XML word processing documents, and so forth. Probably sufficient for a casual user curiosity and low tech.

Mac OS. How can I find out the encoding of a text file through the user interface?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.