piersharding / moodle-tool_uploadcoursecategory

Moodle Admin Tools plugin for basic upload of course categories
23 stars 13 forks source link

doesn't handle commas within category names #2

Open plukethep opened 11 years ago

plukethep commented 11 years ago

For example:

name,idnumber,description CTK College/Business,(AQ) Business,- "CTK College/Science, Maths and H&SC","(AQ) Science, Maths and H&SC",-

The second course breaks it, it seems to have no difficulty with the ampersands. I'll dig into the code and see if I can find a fix.

The error seems to come from a core moodle file: moodle\lib\csvlib.class.php (1 hit) Line 81: function load_csv_content(&$content, $encoding, $delimiter_name, $column_validation=null) {

You can get around it by using &#44 for the comma. Not sure if the core needs updating on this one.

Also trying to add the ascii code for a slash into a category name seems to not come through:

CTK College/Humanities&#44 Art and English/Fine Art (AS&#44A2)

Comes out as

CTK College/Humanities, Art and English/Fine Art (AS&#44A2)

SolutionsDEV commented 9 months ago

In the uploader page there is a selection which is "CSV delimiter", the default is "," therefor any comma in the name or description will not work, but you can choose a character that is not used in your texts like ";" or ":" that is not present in your texts.