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

CommentFileSizeAuthor
#7 data01.txt94 bytescoupet
#4 test-term.xls18 KBcoupet

Comments

decafdennis’s picture

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.

coupet’s picture

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

decafdennis’s picture

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

coupet’s picture

StatusFileSize
new18 KB

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.

decafdennis’s picture

Title: Import fails with special symbol/character » Import multiple terms
Status: Postponed (maintainer needs more info) » Active

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?

decafdennis’s picture

Title: Import multiple terms » Import fails with special symbol/character
Status: Active » Postponed (maintainer needs more info)
coupet’s picture

Title: Import multiple terms » Import fails with special symbol/character
Status: Active » Postponed (maintainer needs more info)
StatusFileSize
new94 bytes

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.

nnn’s picture

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.

nickvidal’s picture

Thanks nnn,

This has worked for me as well.

Be sure your file is encoded in UTF-8

Using gVim:

:setlocal fenc=utf-8

decafdennis’s picture

Status: Postponed (maintainer needs more info) » Active

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

decafdennis’s picture

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!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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