Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C csvkit
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 61
    • Issues 61
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • wireservice
  • csvkit
  • Merge requests
  • !205
An error occurred while fetching the assigned milestone of the selected merge_request.

Fix escaping for quotechar and escapechar

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/dallongo/master into master 12 years ago
  • Overview 0
  • Commits 4
  • Pipelines 0
  • Changes 9

Created by: dallongo

The quote characters were never being escaped because doublequote could never be False. Some changes to csvkit/cli.py were needed because all of the attributes of self.args that we are checking for in the CSVKitUtility class already exist so the 'if' statements should be checking that the attributes are not None type instead of simply checking that they exist. This fixes the problem where 'doublequote=False' is never passed into kwargs.

A bug in the Python built-in csv class does not escape the escapechar when writing out with csv.writer. See http://bugs.python.org/issue12178. I have added a few lines as a work-around in csvkit/unicsv.py for UnicodeCSVWriter.writerow(). In the event that the bug is finally fixed in Python, just remove the 10 lines that I've added.

Compare
  • master (base)

and
  • latest version
    27c2de9f
    4 commits, 2 years ago

9 files
+ 30
- 17

    Preferences

    File browser
    Compare changes
csv‎kit‎
con‎vert‎
csvits‎elf.py‎ +1 -1
dbas‎e.py‎ +1 -1
fixe‎d.py‎ +1 -1
geoj‎s.py‎ +1 -1
js‎.py‎ +1 -1
xls‎.py‎ +2 -1
xls‎x.py‎ +3 -2
cli‎.py‎ +9 -9
unic‎sv.py‎ +11 -0
csvkit/convert/csvitself.py
+ 1
- 1
  • View file @ 27c2de9f


@@ -11,7 +11,7 @@ def csv2csv(f, **kwargs):
tab = table.Table.from_csv(f, **kwargs)
o = StringIO()
output = tab.to_csv(o)
output = tab.to_csv(o, **kwargs)
output = o.getvalue()
o.close()
csvkit/convert/dbase.py
+ 1
- 1
  • View file @ 27c2de9f


@@ -33,7 +33,7 @@ def dbf2csv(f, **kwargs):
tab = table.Table(columns=columns)
o = StringIO()
output = tab.to_csv(o)
output = tab.to_csv(o, **kwargs)
output = o.getvalue()
o.close()
csvkit/convert/fixed.py
+ 1
- 1
  • View file @ 27c2de9f


@@ -26,7 +26,7 @@ def fixed2csv(f, schema, output=None, **kwargs):
except KeyError:
encoding = None
writer = CSVKitWriter(output)
writer = CSVKitWriter(output, **kwargs)
reader = FixedWidthReader(f, schema, encoding=encoding)
writer.writerows(reader)
csvkit/convert/geojs.py
+ 1
- 1
  • View file @ 27c2de9f


@@ -45,7 +45,7 @@ def geojson2csv(f, key=None, **kwargs):
header.append('geojson')
o = StringIO()
writer = CSVKitWriter(o)
writer = CSVKitWriter(o, **kwargs)
writer.writerow(header)
csvkit/convert/js.py
+ 1
- 1
  • View file @ 27c2de9f


@@ -56,7 +56,7 @@ def json2csv(f, key=None, **kwargs):
fields = sorted(list(field_set))
o = StringIO()
writer = CSVKitWriter(o)
writer = CSVKitWriter(o, **kwargs)
writer.writerow(fields)
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference:
Source branch: github/fork/dallongo/master

Menu

Explore Projects Groups Snippets