asafdav / ng-csv

Simple directive that turns arrays and objects into downloadable CSV files
MIT License
573 stars 215 forks source link

Better Excel compability #106

Closed eugenpodaru closed 8 years ago

eugenpodaru commented 8 years ago

Hi David,

I am using your library in a project and it's very nice, saved me some work :). However, our users mostly use Excel and there are two problems with Excel:

I made some modifications to address these problems:

I need these fixes, so for now I will use my repository, but if you choose to put them in the main repository, it would be great.

Cheers, Eugen

Phoenix1978 commented 8 years ago

hello, I have the same problem as you. I tried also with charset="windows-1252" or iso-8859-1 or ANSI or ansi. I also tried to change the charset directly in the JS code :+1: ... var charset = scope.charset || "windows-1252"; ... everywhere utf-8 was present, but at the end, it seems to not use the given charset, using all the time the UTF-8. Is there something to do previously to specify the charset?

Thanks

eugenpodaru commented 8 years ago

@Phoenix1978

Hi,

You can check my fork https://github.com/eugenpodaru/ng-csv. I have added some code to convert between different charsets. I use \t as field separator, utf-16le as charset, and I also add the BOM, and it works perfectly for me.

Eugen

Phoenix1978 commented 8 years ago

Thanks a lot, it works well.

Phoenix1978 commented 8 years ago

Can I ask you another question, I'm kind of newbie on github, and I try to load your fork version directly using bower with this address: https://github.com/eugenpodaru/ng-csv.git But it don't get the same version I can download via the relevant button or via the github website directly.

Do you know which address i had to put to automatically get via bower the last version?

eugenpodaru commented 8 years ago

@Phoenix1978

Hi,

You need to prepend the commit id (hash) https://github.com/eugenpodaru/ng-csv.git#a2aea1f

Regards, Eugen

Phoenix1978 commented 8 years ago

Ok I understand better, thanks again

eugenpodaru commented 8 years ago

@Phoenix1978

Hi,

When you put https://github.com/eugenpodaru/ng-csv.git in bower it will take the latest tagged commit. So in order for that to work I should increase the version number and tag the latest commit.

But I want to be in synch with the original repository when it comes to versioning, so that's why I did not do that.

Eugen

eirikb commented 8 years ago

@eugenpodaru Did you not go through with this PR? I think this should definitely be added to the library, it is great!
I've been trying to add a region-independent solution, and as far as I can see the best solution is UTF16-le with \t as separator.

eugenpodaru commented 8 years ago

@eirikb Yes, the solution that worked for me was UTF16-le and \t as separator. My fork has support for encoding to UTF16-le.

As for the PR, I need to rethink how the encoding is integrated with the solution before I make another PR.