Text file encoding column

The plugin that shows an "Encoding" column:

Before, I created a plugin File MIME type column that used the file.exe utility to determine the file encoding. Unfortunately, it works very slowly.

Thus, I have decided to implement the encoding detection manually using simple heuristics similar to Column: FileInfo plugin.
However, I have added the detection of binary and UTF8 files.

You can download the plugin:
PolarGoose/DirectoryOpus-TextFileEncoding-plugin

2 Likes

To install this, type /scripts into Opus's location bar to locate the scripts folder, then copy text-file-encoding-column.js to it.

(The other files in the GitHub repository don't need to be downloaded.)

@Leo,
Thank you.
Indeed, sorry for the confusion.
A better way is to download the js file from the latest release:
PolarGoose/DirectoryOpus-TextFileEncoding-plugin Releases

1 Like

Thanks for this!

FYI - ANSI detection fails with "?" if a file contains ASCII extended characters.

It is true. Extended ASCII is the wild west. There is no reliable way to determine a specific encoding.
You can also try another script:
File MIME type and Encoding column using libmagic
There is also a potential to use uchardet, but no one has written a plugin using it yet.

OK thanks.

I modified the script so it shows the same encoding as shown by Notepad - ANSI files show as UTF-8 except those with extended ASCII show as ANSI.

I'm guessing this won't be reliable either but I'll see how it goes.