Open CSV file as utf-8

How can I add to Directory Opus an option when I right-click on CSV files to open them in Excel but using utf-8 encoding?

That's more a question about Excel than Opus.

Does Excel have a command line switch to tell it to open files as utf-8 or anything similar? If it does, it's easy to pass it that switch from Opus.

Placing a utf-8 BOM (byte-order-mark) at the start of the files might make Excel interpret them as utf-8 if it doesn't do so automatically, or have any other way to tell it which encoding to use. Opus can do that using a fairly simple script that we can provide. But that would mean modifying the files (the first time they are opened), which you might not want. (Although it is reversible, since it just means adding 3 bytes to the start of the file that say "I'm utf-8", which can be removed it desired as well.)

From a quick google and look around StackOverflow, Excel does not seem to have a switch to open files as utf-8, but newer versions of it (Excel 2013 and above) apparently respect the BOM:

That answer also says you can convert the file to utf-16 which works with older versions of Excel. Opus can do that kind of conversion, but it would mean the file gets modified. (Well, you could have a solution which modifies a temporary copy and opens that, but then any changes you make will be saved to the temporary copy, not the main one.)

Thank you for the quick reply.

Right now, I am opening the CSV file in UltraEdit. Then I am saving it as the same file type but setting the encoding to UTF-8 during the save process.

Then I simply double click on the CSV file in Directory Opus which opens it up in Excel and the content is formatted correctly.

How could I simplify this process using Directory Opus?

Creating the temporary copy of the file as you described would be fine as well.

Preferably through a new right-click option on the file if that would be possible.

You can use this for buttons or commands which add, remove or toggle the UTF-8 BOM at the start of the selected file(s) (or a file specified on the command line):

Thank you Leo. This looks great.

I will experiment with this approach and report back should I run into any issues.