Question
I'm developing a part of an application that's responsible for exporting some
data into CSV files. The application always uses UTF-8 because of its
multilingual nature at all levels. But opening such CSV files (containing e.g.
diacritics, cyrillic letters, Greek letters) in Excel does not achieve the
expected results showing something like Г„/Г¤, Г–/Г¶
. And I don't know how
to force Excel understand that the open CSV file is encoded in UTF-8. I also
tried specifying UTF-8 BOM EF BB BF
, but Excel ignores that.
Is there any workaround?
P.S. Which tools may potentially behave like Excel does?
UPDATE
I have to say that I've confused the community with the formulation of the question. When I was asking this question, I asked for a way of opening a UTF-8 CSV file in Excel without any problems for a user, in a fluent and transparent way. However, I used a wrong formulation asking for doing it automatically. That is very confusing and it clashes with VBA macro automation. There are two answers for this questions that I appreciate the most: the very first answer by Alex, and I've accepted this answer; and the second one by Mark that have appeared a little later. From the usability point of view, Excel seemed to have lack of a good user-friendly UTF-8 CSV support, so I consider both answers are correct, and I have accepted Alex's answer first because it really stated that Excel was not able to do that transparently. That is what I confused with automatically here. Mark's answer promotes a more complicated way for more advanced users to achieve the expected result. Both answers are great, but Alex's one fits my not clearly specified question a little better.
UPDATE 2
Five months later after the last edit, I've noticed that Alex's answer has disappeared for some reason. I really hope it wasn't a technical issue and I hope there is no more discussion on which answer is greater now. So I'm accepting Mark's answer as the best one.
Answer
Alex is correct, but as you have to export to csv, you can give the users this advice when opening the csv files:
- Save the exported file as a csv
- Open Excel
- Import the data using Data-->Import External Data --> Import Data
- Select the file type of "csv" and browse to your file
- In the import wizard change the File_Origin to "65001 UTF" (or choose correct language character identifier)
- Change the Delimiter to comma
- Select where to import to and Finish
This way the special characters should show correctly.