{"action":"created","issue":{"url":"https://api.github.com/repos/datahq/data.js/issues/37","repository_url":"https://api.github.com/repos/datahq/data.js","labels_url":"https://api.github.com/repos/datahq/data.js/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/datahq/data.js/issues/37/comments","events_url":"https://api.github.com/repos/datahq/data.js/issues/37/events","html_url":"https://github.com/datahq/data.js/issues/37","id":300520695,"number":37,"title":"[File] recognize encoding for remote resource","user":{"login":"AcckiyGerman","id":11707682,"avatar_url":"https://avatars0.githubusercontent.com/u/11707682?v=4","gravatar_id":"","url":"https://api.github.com/users/AcckiyGerman","html_url":"https://github.com/AcckiyGerman","followers_url":"https://api.github.com/users/AcckiyGerman/followers","following_url":"https://api.github.com/users/AcckiyGerman/following{/other_user}","gists_url":"https://api.github.com/users/AcckiyGerman/gists{/gist_id}","starred_url":"https://api.github.com/users/AcckiyGerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AcckiyGerman/subscriptions","organizations_url":"https://api.github.com/users/AcckiyGerman/orgs","repos_url":"https://api.github.com/users/AcckiyGerman/repos","events_url":"https://api.github.com/users/AcckiyGerman/events{/privacy}","received_events_url":"https://api.github.com/users/AcckiyGerman/received_events","type":"User","site_admin":false},"labels":[{"id":665374357,"url":"https://api.github.com/repos/datahq/data.js/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":665374358,"url":"https://api.github.com/repos/datahq/data.js/labels/help%20wanted","name":"help wanted","color":"128A0C","default":true}],"state":"open","locked":false,"assignee":{"login":"AcckiyGerman","id":11707682,"avatar_url":"https://avatars0.githubusercontent.com/u/11707682?v=4","gravatar_id":"","url":"https://api.github.com/users/AcckiyGerman","html_url":"https://github.com/AcckiyGerman","followers_url":"https://api.github.com/users/AcckiyGerman/followers","following_url":"https://api.github.com/users/AcckiyGerman/following{/other_user}","gists_url":"https://api.github.com/users/AcckiyGerman/gists{/gist_id}","starred_url":"https://api.github.com/users/AcckiyGerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AcckiyGerman/subscriptions","organizations_url":"https://api.github.com/users/AcckiyGerman/orgs","repos_url":"https://api.github.com/users/AcckiyGerman/repos","events_url":"https://api.github.com/users/AcckiyGerman/events{/privacy}","received_events_url":"https://api.github.com/users/AcckiyGerman/received_events","type":"User","site_admin":false},"assignees":[{"login":"AcckiyGerman","id":11707682,"avatar_url":"https://avatars0.githubusercontent.com/u/11707682?v=4","gravatar_id":"","url":"https://api.github.com/users/AcckiyGerman","html_url":"https://github.com/AcckiyGerman","followers_url":"https://api.github.com/users/AcckiyGerman/followers","following_url":"https://api.github.com/users/AcckiyGerman/following{/other_user}","gists_url":"https://api.github.com/users/AcckiyGerman/gists{/gist_id}","starred_url":"https://api.github.com/users/AcckiyGerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AcckiyGerman/subscriptions","organizations_url":"https://api.github.com/users/AcckiyGerman/orgs","repos_url":"https://api.github.com/users/AcckiyGerman/repos","events_url":"https://api.github.com/users/AcckiyGerman/events{/privacy}","received_events_url":"https://api.github.com/users/AcckiyGerman/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/datahq/data.js/milestones/18","html_url":"https://github.com/datahq/data.js/milestone/18","labels_url":"https://api.github.com/repos/datahq/data.js/milestones/18/labels","id":3098923,"number":18,"title":"Sprint - 12 Mar 2018","description":"","creator":{"login":"Mikanebu","id":19908588,"avatar_url":"https://avatars2.githubusercontent.com/u/19908588?v=4","gravatar_id":"","url":"https://api.github.com/users/Mikanebu","html_url":"https://github.com/Mikanebu","followers_url":"https://api.github.com/users/Mikanebu/followers","following_url":"https://api.github.com/users/Mikanebu/following{/other_user}","gists_url":"https://api.github.com/users/Mikanebu/gists{/gist_id}","starred_url":"https://api.github.com/users/Mikanebu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mikanebu/subscriptions","organizations_url":"https://api.github.com/users/Mikanebu/orgs","repos_url":"https://api.github.com/users/Mikanebu/repos","events_url":"https://api.github.com/users/Mikanebu/events{/privacy}","received_events_url":"https://api.github.com/users/Mikanebu/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"open","created_at":"2018-02-08T07:18:11Z","updated_at":"2018-02-28T07:42:30Z","due_on":"2018-03-12T07:00:00Z","closed_at":null},"comments":2,"created_at":"2018-02-27T07:30:33Z","updated_at":"2018-03-08T07:07:26Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Original: https://github.com/datahq/datahub-qa/issues/105\r\n```javascript\r\nFile = require('data.js').File\r\n// loading ISO8859 resource:\r\n> file = File.load('https://raw.githubusercontent.com/frictionlessdata/test-data/master/files/csv/encodings/iso8859.csv')\r\n> file.encoding\r\n'utf-8'\r\n```\r\n## Acceptance criteria\r\n- `File.load('https://raw.githubusercontent.com/frictionlessdata/test-data/master/files/csv/encodings/iso8859.csv').encoding == 'ISO-8859-1'`\r\n- `File.load('https://raw.githubusercontent.com/frictionlessdata/test-data/master/files/csv/encodings/western-macos-roman.csv').encoding == <macOS-roman-or-so>`\r\n\r\n## Tasks\r\n\r\n- [ ] add test\r\n- [ ] realize encoding recognize\r\n\r\n## Analysis\r\n\r\nWe need to change this method:\r\n```javascript\r\nclass FileRemote extends File {\r\n   ...\r\n   get encoding() {\r\n       return DEFAULT_ENCODING\r\n  }\r\n```\r\n\r\n## analysis update\r\n\r\n`encoding()` method should:\r\n- connect to remote resource\r\n- get small portion of raw-data\r\n- try to recognize encoding\r\n\r\nI tried to implement this schema, using `chardet.detectFileSync()` lib but it works only with files - any argument is treated as a file-name.\r\n\r\nPossible solutions:\r\n- save a part of remote resource in a local temp file, then use  `chardet.detectFileSync(temp)`\r\n- use some other lib to recognize encoding using remote Stream\r\n"},"comment":{"url":"https://api.github.com/repos/datahq/data.js/issues/comments/371399681","html_url":"https://github.com/datahq/data.js/issues/37#issuecomment-371399681","issue_url":"https://api.github.com/repos/datahq/data.js/issues/37","id":371399681,"user":{"login":"AcckiyGerman","id":11707682,"avatar_url":"https://avatars0.githubusercontent.com/u/11707682?v=4","gravatar_id":"","url":"https://api.github.com/users/AcckiyGerman","html_url":"https://github.com/AcckiyGerman","followers_url":"https://api.github.com/users/AcckiyGerman/followers","following_url":"https://api.github.com/users/AcckiyGerman/following{/other_user}","gists_url":"https://api.github.com/users/AcckiyGerman/gists{/gist_id}","starred_url":"https://api.github.com/users/AcckiyGerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AcckiyGerman/subscriptions","organizations_url":"https://api.github.com/users/AcckiyGerman/orgs","repos_url":"https://api.github.com/users/AcckiyGerman/repos","events_url":"https://api.github.com/users/AcckiyGerman/events{/privacy}","received_events_url":"https://api.github.com/users/AcckiyGerman/received_events","type":"User","site_admin":false},"created_at":"2018-03-08T07:07:26Z","updated_at":"2018-03-08T07:07:26Z","author_association":"CONTRIBUTOR","body":"I had no time to work with this, but I still want to finish it."}}
{"actor":{"display_login":"AcckiyGerman"}}