I am in a danmark website project. When I used this module import a csv taxonomy list to drupal, I found some chars are not support by this module.

I have fixed what happend, and I will give you an advise, but I think the author of this module maybe have better idea.

First of all, I will describ why:

Because the core function fgetcsv depend on OS and OS's locale settings. so, I think here should be more flexable.

What I do is:
in file:taxonomy_csv.api.inc

about line:469

  $line = fgetcsv($handle, 32768, $options['delimiter'], $options['enclosure']);

I changed it to :

  $locale = setlocale(LC_CTYPE, 0);
  setlocale(LC_CTYPE, 'en_DK.utf8');
  $line = fgetcsv($handle, 32768, $options['delimiter'], $options['enclosure']);
  setlocale(LC_CTYPE, $locale);

because en_DK.utf8 is my OS locale setting.

It is a ugly patch, what I wish is that it should be a setting for administrator.

Comments

Daniel_KM’s picture

Hi,

Thanks for your code.
Other non-latin people have post same issues in the past. I say them to use an enclosure ( " ) and it solves problem.

Nevertheless, I'm going to add an option to set local before import and to reset after. New release of Taxonomy csv for Drupal 7 will be committed during this week.

Sincerely,

Daniel Berthereau
Knowledge manager

vipzhicheng’s picture

Yes, your decision is wrong, because a lot of csv will not be generated by myself, and alway from my clients, so if I must use an enclosure, it will be meaningless to me, lol, thanks for your work.

Daniel_KM’s picture

Hi,

New releases of Taxonomy csv Import/Export for Drupal 6 and Drupal 7 integrate your patch (and some other improvements). You can now set your locale before import if you need it.

Sincerely,

Daniel Berthereau
Knowledge Manager

Daniel_KM’s picture

Version: 7.x-4.11 » 7.x-5.3
Priority: Critical » Normal
Status: Active » Closed (fixed)