#2692: v.in.ascii does not handle text in qoutes -------------------------+------------------------------------------------- Reporter: wenzeslaus | Owner: grass-dev@… Type: defect | Status: new Priority: normal | Milestone: 7.0.1 Component: Default | Version: svn-trunk Resolution: | Keywords: CSV, doublequote, singlequote, text CPU: | delimiter Unspecified | Platform: Unspecified -------------------------+-------------------------------------------------
Comment (by glynn): Replying to [comment:2 mlennert]: > The attached patch seems to solve the problem for me, but it feels like a quick fix and there probably is a better way... Simply removing the quotes isn't sufficient to support CSV. It's necessary to treat the field separator as a normal character when it occurs within a quoted field (that's the point of using quotes), and also to replace two consecutive quotes with a single quote (so that the quote character itself can occur within a field). For that, an explicit state machine is likely to be more legible than ad- hoc logic. Off the top of my head: {{{ classes: delimiter, separator, newline, other states: start, in_quote, after_quote, error actions: no_op, add_char, new_field, end_record, error start,delimiter -> in_quote,no_op start,separator -> start,new_field start,newline -> start,end_record start,other -> start,add_char in_quote,delimiter -> after_quote,no_op in_quote,separator -> in_quote,add_char in_quote,newline -> error,error in_quote,other -> in_quote,add_char after_quote,delimiter -> in_quote,add_char after_quote,separator -> start,new_field after_quote,newline -> start,end_record after_quote,other -> error,error }}} -- Ticket URL: <https://trac.osgeo.org/grass/ticket/2692#comment:3> GRASS GIS <http://grass.osgeo.org> _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev