0

I have written a code that simply read data from JavaScript array and make a .csv file and let it download. but when we open that file in excel the "€" euro symbol get distorted.

This is the coding, I have applied all kind of encoding and charset, but the noting bearing result.

Coding enter image description here

And output of program in browser

Output in browser enter image description here

And now after download and open of file output

Output in excel enter image description here

My office excel version is

Excel Version enter image description here

I want to ask that how to forcefully, every excel reader to use our encoding like "UTF-8", Please help me, i have been looking for the solution for very long time.

Thilina Nakkawita
  • 1,302
  • 3
  • 19
  • 33
  • Cannot reproducing. Following works for me: http://jsfiddle.net/z2rpydmw/6/ – Axel Richter Jan 24 '19 at 08:46
  • For Excel, either ensure your javascript writes a `BOM` at the start of the file, or **IMPORT** the file, at which time the dialog should present an option for the encoding. – Ron Rosenfeld Jan 24 '19 at 11:02
  • I followed the link given by "jsfiddle.net/z2rpydmw/6 – Axel Richter" , and download the file opened the downloaded file and see it, nothing giving me the result. price 1,234.56 € 7.89 € – Enexion_India Jan 25 '19 at 05:09
  • Can you please opening the downloaded file `my-csv.csv` using a text editor? Same result? – Axel Richter Jan 25 '19 at 08:23
  • Yes i know and i have opened the my-csv.csv file in text editor in notepad, it is appearing perfectly ""name","price" "art1","1,234.56 €" "art2","7.89 €"", it is also opened well in other version of office 2007 and higher version of office, but our requirement is that, it should open perfectly in client device of user device and show euro "€" symbol perfectly without bothering the user to instruct them to do this and that, like export that file in excel using "utf-8" encoding and bla bla bla, user should be able to see euro symbol irrespective of csv file reader or encoding. – Enexion_India Jan 25 '19 at 08:57
  • All informations in your last comment, especially that it only fails in a very special `Excel` version, should be part of your question. Then it might attract more users who probably had the same issue. But what I would do now is opening that special `Excel` version. Then getting the `my-csv.csv` using [Text Import Wizard](https://support.office.com/en-us/article/text-import-wizard-c5b02af6-fda1-4440-899f-f78bafe41857). Is that working? What `File origin` is shown in step 1? Should be `65001 Unicode (UTF-8)`. – Axel Richter Jan 25 '19 at 09:12
  • "user should be able to see euro symbol irrespective of csv file reader or encoding": This is not possible. The euro symbol needs either Unicode or one of the 8-bit ISO encodings which have a codepoint for it. – Axel Richter Jan 25 '19 at 09:17

0 Answers0