{"action":"closed","issue":{"url":"https://api.github.com/repos/deni-zen/csvelte/issues/17","repository_url":"https://api.github.com/repos/deni-zen/csvelte","labels_url":"https://api.github.com/repos/deni-zen/csvelte/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/deni-zen/csvelte/issues/17/comments","events_url":"https://api.github.com/repos/deni-zen/csvelte/issues/17/events","html_url":"https://github.com/deni-zen/csvelte/issues/17","id":164666391,"number":17,"title":"Stream buffer/filter for quoted special char placeholders","user":{"login":"deni-zen","id":17840996,"avatar_url":"https://avatars.githubusercontent.com/u/17840996?v=3","gravatar_id":"","url":"https://api.github.com/users/deni-zen","html_url":"https://github.com/deni-zen","followers_url":"https://api.github.com/users/deni-zen/followers","following_url":"https://api.github.com/users/deni-zen/following{/other_user}","gists_url":"https://api.github.com/users/deni-zen/gists{/gist_id}","starred_url":"https://api.github.com/users/deni-zen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deni-zen/subscriptions","organizations_url":"https://api.github.com/users/deni-zen/orgs","repos_url":"https://api.github.com/users/deni-zen/repos","events_url":"https://api.github.com/users/deni-zen/events{/privacy}","received_events_url":"https://api.github.com/users/deni-zen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-09T13:09:45Z","updated_at":"2016-07-13T12:54:46Z","closed_at":"2016-07-13T12:54:46Z","body":"When newlines and other special characters fall within quoted strings, they should be treated as normal characters and not terminate the line (in respect to the CSV reader). The newline characters should be passed into the reader as-is. As should the delimiter and any other special character that falls within quotes. \r\n\r\n**This is a list of edge cases and caveats that I must remember to test before this can be considered solved:**\r\n\r\n- [x] Double quotes should NOT terminate a quoted string. So if I have a string like this: \"I am a string \"\"with a double quoted string containing a line break\"\". Yay for strings...\\n and line breaks!\", The entire string should be passed into the reader as one line... as-is. The double quote may be converted to single quote within the reader.\r\n- [ ] Get rid of the old stream wrapper and stream filter code you were attempting to use. \r\n- [x] readLine has been changed to nextLine... switch them back. That way readLine can stay in whatever the Input class is and nextLine will perform all the quoted newline magic **note:** _I didn't switch them back because I couldn't use parent::readLine within the trait (the readLine method on the class using the trait would override the trait's readLine method). So instead I kept the trait method as readLine and added an abstract nextLine method that trait users must implement, effectively doing the same thing_ \r\n- [x] Make sure that single quotes are handled correctly too. Write tests to make sure that apostrophes aren't going to cause any issues, single quoted strings, double-single quoted strings within single quoted strings ('This is a single quoted string ''with a double single quoted string inside it''. Kind of silly to use double-single quotes rather than a double quote but it could happen.')\r\n- [x] Make sure the escape character actually escapes things when determining whether a quote character \"opens\" or \"closes\" a quoted string. \r\n- [x] $eol argument should probably default to PHP_EOL\r\n- [x] fix bug that causes buffered lines to be discarded when reader hits EOL\r\n- [ ] the escapeChar should be configurable by passing in a different one as a third arg or by initializing with a flavor or something\r\n\r\nMoved the following out of the list as they are not within the scope of this issue. I need to move them into their own tickets.\r\n\r\n- [ ] Make sure that line endings are treated properly, that is, the reader respects which character(s) have been specified as the line terminator within the flavor object.\r\n- [ ] The reader needs to do something similar with special chars when it splits up the rows into columns but it isn't quite as tricky. It simply looks for quoted strings and replaces newlines and special characters (delimiters, quotes, etc.) with an \"encoded\" version of them and then once it has its columns, it switches them back. Right now all this functionality is in the main Reader class. Probably should move it into a trait as well.\r\n"}}
{"actor":{"display_login":"deni-zen"}}