Rails FasterCSV “unquoted fields do not allow \r or \n”

后端 未结 3 1131
终归单人心
终归单人心 2020-12-18 07:55

I\'m having an issue with FasterCSV and my rake db:seeds migration. I get the error: \"rake aborted! Unquoted fields do not allow \\r or \\n (line 2)\" on the following se

相关标签:
3条回答
  • 2020-12-18 08:22

    It was as simple as clearing all the formatting off in the csv. Excel seems to have a habit of retaining a lot of the formatting after saving in a csv file, which was causing the failure. After I copied and pasted all the data with no formatting in a new csv file, it was fine.

    0 讨论(0)
  • 2020-12-18 08:22

    I do not have enough reputation to comment, but I wanted to say that I have been looking this error across the web day and night for a long time and finally found the solution in the comments, by mu is too short.

    I finally got it to work when I put quotes around all of my values.

    EDIT: Link to answer!!! Rails FasterCSV "unquoted fields do not allow \r or \n"

    0 讨论(0)
  • 2020-12-18 08:42

    Use String.encode(universal_newline: true) instead gsub. It converting CRLF and CR to LF # Always break lines with \n

    0 讨论(0)
提交回复
热议问题