Import fails with special symbol/character

coupet - March 13, 2008 - 01:35
Project:Taxonomy CSV import/export
Version:6.x-1.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Unable to import a CSV file with more than 3 terms. Displays error message when attempting to import a file with 4 terms. I think that functionality worked in 5.x version. Works with 3 terms OK.

Darly

#1

naquah - March 13, 2008 - 08:49

I have been able to import a hierarchical tree of US states and counties from a single CSV file. Especially the batch API (with the progressbar) makes it possible to import large files without script timeouts.

So I will need to know what error message you're getting and preferable what CSV file you're trying to import.

#2

coupet - March 13, 2008 - 19:49

The scenario is as follows:

Vocabulary: Car

Term1: Term2: Term3: Term4:
Year Make Model Type
2000 BMW 318 Sedan
2000 BMW 318 Coupe
2001 Ford Taurus Sedan

-Term1 (Year)
-Term2 (Make)
-Term3 (Model)
-Term4 (Type)

Darly

#3

naquah - March 13, 2008 - 21:49

I need the exact file, and the error message you're getting. Otherwise I can't help you.

#4

coupet - March 14, 2008 - 09:57

Hello naquah,

I think the problem was a square symbol inside the term name. I removed it and everything works now.

Thanks, Darly

Note: see attached file with term name.

AttachmentSize
test-term.xls 18 KB

#5

naquah - March 17, 2008 - 19:31

coupet, I would like to investigate the problem so that it won't happen again to somebody else. Can you give me the exact CSV file you used (so not the Excel file) and the exact error message you got?

#6

naquah - March 17, 2008 - 19:30
Title:Import multiple terms» Import fails with special symbol/character
Status:active» postponed (maintainer needs more info)

#7

coupet - March 18, 2008 - 19:28

naquah, attached is the csv file. I renamed the file extension to txt to allow for upload. Unable to upload file with csv extension. The original file was created in microsoft excel and save as a csv file.

Seems Character Sets and Encodings issue.

AttachmentSize
data01.txt 94 bytes

#8

nnn - March 26, 2008 - 04:22

I think if you add a line

setlocale(LC_ALL, 'en_US.UTF-8');

before the line

while ($line = fgetcsv($handle, 4096, $delimiter)) {
}

it will work. At least that's what worked for my file with multibyte strings. I guess you can add an option to the csv import form for setting this value.

#9

nickvidal - March 28, 2008 - 17:47

Thanks nnn,

This has worked for me as well.

Be sure your file is encoded in UTF-8

Using gVim:

:setlocal fenc=utf-8

#10

naquah - April 7, 2008 - 09:53
Status:postponed (maintainer needs more info)» active

Alright, I'll try to make it work with any encoding.

#11

naquah - April 19, 2008 - 17:37
Status:active» fixed

The batch API crashed as a result from the Windows-encoded lines. Fixed by base64-encoding the lines before passing them to the batch operations array.

Fixed in the latest development version.

Thanks!

#12

Anonymous (not verified) - May 3, 2008 - 17:44
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.