Try setting r.LazyQuotes=true

On Thu, 28 Sep 2017, at 09:56 PM, Lantos István wrote:
> 
> I want to parse the following CSV structure. The column separators
> are tabs:> 
> *package main*
> 
> *import (*
> *    "encoding/csv"*
> *    "fmt"*
> *    "log"*
> *    "strings"*
> *)*
> 
> *func main() {*
> *    in := `This    "is" not    fun`*
> *    r := csv.NewReader(strings.NewReader(in))*
> *    r.Comma = '\t'*
> 
> *    records, err := r.ReadAll()*
> *    if err != nil {*
> *        log.Fatal(err)*
> *    }*
> 
> *    fmt.Print(records)*
> *}*
> **
> Google Playground[1]*
** *There is a tab after **This** and before **fun**. Between **"is"**
and* *not** there is only a space. This should be one column. I  setted
the column separator with* *r.Comma ="\t"**, but for some reason I'm
getting the following error:> 
> **line 1, column 8: extraneous " in field**
> 
> Is there a way to achieve what I want?
> 
> 
> 


> --
>  You received this message because you are subscribed to the Google
>  Groups "golang-nuts" group.>  To unsubscribe from this group and stop 
> receiving emails from it,
>  send an email to golang-nuts+unsubscr...@googlegroups.com.>  For more 
> options, visit https://groups.google.com/d/optout.


Links:

  1. https://play.golang.org/p/ZZ5t-lvfaK

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to