{"action":"created","comment":{"url":"https://api.github.com/repos/nitlang/nit/pulls/comments/60403159","id":60403159,"diff_hunk":"@@ -1184,10 +1183,11 @@ redef class NativeString\n \t\treturn new FlatString.with_infos(self, len, 0)\n \tend\n \n-\t# Returns `self` as a new String.\n-\tredef fun to_s_with_copy: FlatString\n+\tredef fun to_s_with_copy do return to_s_with_copy_and_length(cstring_length)\n+\n+\t# Get a `String` from `length` bytes at `self` copied into Nit memory\n+\tfun to_s_with_copy_and_length(length: Int): String","path":"lib/core/text/flat.nit","position":19,"original_position":19,"commit_id":"e08de594124439847cb22691ba6a15adfe11641b","original_commit_id":"e08de594124439847cb22691ba6a15adfe11641b","user":{"login":"privat","id":135828,"avatar_url":"https://avatars.githubusercontent.com/u/135828?v=3","gravatar_id":"","url":"https://api.github.com/users/privat","html_url":"https://github.com/privat","followers_url":"https://api.github.com/users/privat/followers","following_url":"https://api.github.com/users/privat/following{/other_user}","gists_url":"https://api.github.com/users/privat/gists{/gist_id}","starred_url":"https://api.github.com/users/privat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/privat/subscriptions","organizations_url":"https://api.github.com/users/privat/orgs","repos_url":"https://api.github.com/users/privat/repos","events_url":"https://api.github.com/users/privat/events{/privacy}","received_events_url":"https://api.github.com/users/privat/received_events","type":"User","site_admin":false},"body":"I propose to use some fine 2KY OO-design approach\r\n\r\n~~~nit\r\nclass ToStringer\r\n   fun copy(from: NativeString): String do ...\r\nend\r\nclass ToStringerWithLength\r\n  super ToStringer\r\n  var length: Int\r\n  redef fun copy(from) do ...\r\nend\r\nclass ToStringerWithCopy\r\n  super ToStringer\r\n  redef fun copy(from) do ...\r\nend\r\nclass ToStringerWithCopyAndLength\r\n  super ToStingerWithLength\r\n  super ToStingerWithCopy\r\nend\r\n~~~","created_at":"2016-04-20T13:08:48Z","updated_at":"2016-04-20T13:08:48Z","html_url":"https://github.com/nitlang/nit/pull/2021#discussion_r60403159","pull_request_url":"https://api.github.com/repos/nitlang/nit/pulls/2021","_links":{"self":{"href":"https://api.github.com/repos/nitlang/nit/pulls/comments/60403159"},"html":{"href":"https://github.com/nitlang/nit/pull/2021#discussion_r60403159"},"pull_request":{"href":"https://api.github.com/repos/nitlang/nit/pulls/2021"}}},"pull_request":{"url":"https://api.github.com/repos/nitlang/nit/pulls/2021","id":66909524,"html_url":"https://github.com/nitlang/nit/pull/2021","diff_url":"https://github.com/nitlang/nit/pull/2021.diff","patch_url":"https://github.com/nitlang/nit/pull/2021.patch","issue_url":"https://api.github.com/repos/nitlang/nit/issues/2021","number":2021,"state":"open","locked":false,"title":"iOS and text: fix UTF-8 support on iOS and improve doc on FFI related text services","user":{"login":"xymus","id":208057,"avatar_url":"https://avatars.githubusercontent.com/u/208057?v=3","gravatar_id":"","url":"https://api.github.com/users/xymus","html_url":"https://github.com/xymus","followers_url":"https://api.github.com/users/xymus/followers","following_url":"https://api.github.com/users/xymus/following{/other_user}","gists_url":"https://api.github.com/users/xymus/gists{/gist_id}","starred_url":"https://api.github.com/users/xymus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xymus/subscriptions","organizations_url":"https://api.github.com/users/xymus/orgs","repos_url":"https://api.github.com/users/xymus/repos","events_url":"https://api.github.com/users/xymus/events{/privacy}","received_events_url":"https://api.github.com/users/xymus/received_events","type":"User","site_admin":false},"body":"This PR fix the support for UTF-8 on iOS by simply updating the encoding and use the correct number of bytes. This does not completely resolve #1945 as the error messages are still present and I suspect that the UTF-8 cleaning does not work, however I'll update the issue (or open a different one) to reflect that.\r\n\r\nIntro the service `to_s_with_copy_and_length` which complements `to_s_with_copy` and `to_s_with_length` . The name is a mouthful, but using optional parameters was not desirable since this service will often be used from a foreign language.\r\n\r\nAlso improves the doc of the existing services to get a Nit `String` from a `NativeString`. The new doc is more detailed and oriented towards users of the FFI by putting emphasis on where the raw data resides and wether it is cleaned or not.\r\n\r\nAlso note the removal of return type declarations in method refinements which was not consistent with the introduction.","created_at":"2016-04-18T19:39:31Z","updated_at":"2016-04-20T13:08:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff35ea39526d30e52ed61ee472f008ac995756bf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nitlang/nit/pulls/2021/commits","review_comments_url":"https://api.github.com/repos/nitlang/nit/pulls/2021/comments","review_comment_url":"https://api.github.com/repos/nitlang/nit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nitlang/nit/issues/2021/comments","statuses_url":"https://api.github.com/repos/nitlang/nit/statuses/e08de594124439847cb22691ba6a15adfe11641b","head":{"label":"xymus:ios-utf8","ref":"ios-utf8","sha":"e08de594124439847cb22691ba6a15adfe11641b","user":{"login":"xymus","id":208057,"avatar_url":"https://avatars.githubusercontent.com/u/208057?v=3","gravatar_id":"","url":"https://api.github.com/users/xymus","html_url":"https://github.com/xymus","followers_url":"https://api.github.com/users/xymus/followers","following_url":"https://api.github.com/users/xymus/following{/other_user}","gists_url":"https://api.github.com/users/xymus/gists{/gist_id}","starred_url":"https://api.github.com/users/xymus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xymus/subscriptions","organizations_url":"https://api.github.com/users/xymus/orgs","repos_url":"https://api.github.com/users/xymus/repos","events_url":"https://api.github.com/users/xymus/events{/privacy}","received_events_url":"https://api.github.com/users/xymus/received_events","type":"User","site_admin":false},"repo":{"id":1275771,"name":"nit","full_name":"xymus/nit","owner":{"login":"xymus","id":208057,"avatar_url":"https://avatars.githubusercontent.com/u/208057?v=3","gravatar_id":"","url":"https://api.github.com/users/xymus","html_url":"https://github.com/xymus","followers_url":"https://api.github.com/users/xymus/followers","following_url":"https://api.github.com/users/xymus/following{/other_user}","gists_url":"https://api.github.com/users/xymus/gists{/gist_id}","starred_url":"https://api.github.com/users/xymus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xymus/subscriptions","organizations_url":"https://api.github.com/users/xymus/orgs","repos_url":"https://api.github.com/users/xymus/repos","events_url":"https://api.github.com/users/xymus/events{/privacy}","received_events_url":"https://api.github.com/users/xymus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xymus/nit","description":"Nit language","fork":true,"url":"https://api.github.com/repos/xymus/nit","forks_url":"https://api.github.com/repos/xymus/nit/forks","keys_url":"https://api.github.com/repos/xymus/nit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xymus/nit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xymus/nit/teams","hooks_url":"https://api.github.com/repos/xymus/nit/hooks","issue_events_url":"https://api.github.com/repos/xymus/nit/issues/events{/number}","events_url":"https://api.github.com/repos/xymus/nit/events","assignees_url":"https://api.github.com/repos/xymus/nit/assignees{/user}","branches_url":"https://api.github.com/repos/xymus/nit/branches{/branch}","tags_url":"https://api.github.com/repos/xymus/nit/tags","blobs_url":"https://api.github.com/repos/xymus/nit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xymus/nit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xymus/nit/git/refs{/sha}","trees_url":"https://api.github.com/repos/xymus/nit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xymus/nit/statuses/{sha}","languages_url":"https://api.github.com/repos/xymus/nit/languages","stargazers_url":"https://api.github.com/repos/xymus/nit/stargazers","contributors_url":"https://api.github.com/repos/xymus/nit/contributors","subscribers_url":"https://api.github.com/repos/xymus/nit/subscribers","subscription_url":"https://api.github.com/repos/xymus/nit/subscription","commits_url":"https://api.github.com/repos/xymus/nit/commits{/sha}","git_commits_url":"https://api.github.com/repos/xymus/nit/git/commits{/sha}","comments_url":"https://api.github.com/repos/xymus/nit/comments{/number}","issue_comment_url":"https://api.github.com/repos/xymus/nit/issues/comments{/number}","contents_url":"https://api.github.com/repos/xymus/nit/contents/{+path}","compare_url":"https://api.github.com/repos/xymus/nit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xymus/nit/merges","archive_url":"https://api.github.com/repos/xymus/nit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xymus/nit/downloads","issues_url":"https://api.github.com/repos/xymus/nit/issues{/number}","pulls_url":"https://api.github.com/repos/xymus/nit/pulls{/number}","milestones_url":"https://api.github.com/repos/xymus/nit/milestones{/number}","notifications_url":"https://api.github.com/repos/xymus/nit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xymus/nit/labels{/name}","releases_url":"https://api.github.com/repos/xymus/nit/releases{/id}","deployments_url":"https://api.github.com/repos/xymus/nit/deployments","created_at":"2011-01-20T19:43:31Z","updated_at":"2015-04-06T14:41:09Z","pushed_at":"2016-04-20T12:03:11Z","git_url":"git://github.com/xymus/nit.git","ssh_url":"git@github.com:xymus/nit.git","clone_url":"https://github.com/xymus/nit.git","svn_url":"https://github.com/xymus/nit","homepage":"http://nitlanguage.org","size":119966,"stargazers_count":8,"watchers_count":8,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":8,"default_branch":"master"}},"base":{"label":"nitlang:master","ref":"master","sha":"9c33e8a15cb314b18d3622dd436aeac7f9ac5cbd","user":{"login":"nitlang","id":5420298,"avatar_url":"https://avatars.githubusercontent.com/u/5420298?v=3","gravatar_id":"","url":"https://api.github.com/users/nitlang","html_url":"https://github.com/nitlang","followers_url":"https://api.github.com/users/nitlang/followers","following_url":"https://api.github.com/users/nitlang/following{/other_user}","gists_url":"https://api.github.com/users/nitlang/gists{/gist_id}","starred_url":"https://api.github.com/users/nitlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nitlang/subscriptions","organizations_url":"https://api.github.com/users/nitlang/orgs","repos_url":"https://api.github.com/users/nitlang/repos","events_url":"https://api.github.com/users/nitlang/events{/privacy}","received_events_url":"https://api.github.com/users/nitlang/received_events","type":"Organization","site_admin":false},"repo":{"id":328597,"name":"nit","full_name":"nitlang/nit","owner":{"login":"nitlang","id":5420298,"avatar_url":"https://avatars.githubusercontent.com/u/5420298?v=3","gravatar_id":"","url":"https://api.github.com/users/nitlang","html_url":"https://github.com/nitlang","followers_url":"https://api.github.com/users/nitlang/followers","following_url":"https://api.github.com/users/nitlang/following{/other_user}","gists_url":"https://api.github.com/users/nitlang/gists{/gist_id}","starred_url":"https://api.github.com/users/nitlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nitlang/subscriptions","organizations_url":"https://api.github.com/users/nitlang/orgs","repos_url":"https://api.github.com/users/nitlang/repos","events_url":"https://api.github.com/users/nitlang/events{/privacy}","received_events_url":"https://api.github.com/users/nitlang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nitlang/nit","description":"Nit language","fork":false,"url":"https://api.github.com/repos/nitlang/nit","forks_url":"https://api.github.com/repos/nitlang/nit/forks","keys_url":"https://api.github.com/repos/nitlang/nit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nitlang/nit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nitlang/nit/teams","hooks_url":"https://api.github.com/repos/nitlang/nit/hooks","issue_events_url":"https://api.github.com/repos/nitlang/nit/issues/events{/number}","events_url":"https://api.github.com/repos/nitlang/nit/events","assignees_url":"https://api.github.com/repos/nitlang/nit/assignees{/user}","branches_url":"https://api.github.com/repos/nitlang/nit/branches{/branch}","tags_url":"https://api.github.com/repos/nitlang/nit/tags","blobs_url":"https://api.github.com/repos/nitlang/nit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nitlang/nit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nitlang/nit/git/refs{/sha}","trees_url":"https://api.github.com/repos/nitlang/nit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nitlang/nit/statuses/{sha}","languages_url":"https://api.github.com/repos/nitlang/nit/languages","stargazers_url":"https://api.github.com/repos/nitlang/nit/stargazers","contributors_url":"https://api.github.com/repos/nitlang/nit/contributors","subscribers_url":"https://api.github.com/repos/nitlang/nit/subscribers","subscription_url":"https://api.github.com/repos/nitlang/nit/subscription","commits_url":"https://api.github.com/repos/nitlang/nit/commits{/sha}","git_commits_url":"https://api.github.com/repos/nitlang/nit/git/commits{/sha}","comments_url":"https://api.github.com/repos/nitlang/nit/comments{/number}","issue_comment_url":"https://api.github.com/repos/nitlang/nit/issues/comments{/number}","contents_url":"https://api.github.com/repos/nitlang/nit/contents/{+path}","compare_url":"https://api.github.com/repos/nitlang/nit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nitlang/nit/merges","archive_url":"https://api.github.com/repos/nitlang/nit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nitlang/nit/downloads","issues_url":"https://api.github.com/repos/nitlang/nit/issues{/number}","pulls_url":"https://api.github.com/repos/nitlang/nit/pulls{/number}","milestones_url":"https://api.github.com/repos/nitlang/nit/milestones{/number}","notifications_url":"https://api.github.com/repos/nitlang/nit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nitlang/nit/labels{/name}","releases_url":"https://api.github.com/repos/nitlang/nit/releases{/id}","deployments_url":"https://api.github.com/repos/nitlang/nit/deployments","created_at":"2009-10-06T15:03:00Z","updated_at":"2016-04-17T19:33:08Z","pushed_at":"2016-04-20T12:03:12Z","git_url":"git://github.com/nitlang/nit.git","ssh_url":"git@github.com:nitlang/nit.git","clone_url":"https://github.com/nitlang/nit.git","svn_url":"https://github.com/nitlang/nit","homepage":"http://nitlanguage.org","size":131293,"stargazers_count":94,"watchers_count":94,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":142,"forks":49,"open_issues":142,"watchers":94,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nitlang/nit/pulls/2021"},"html":{"href":"https://github.com/nitlang/nit/pull/2021"},"issue":{"href":"https://api.github.com/repos/nitlang/nit/issues/2021"},"comments":{"href":"https://api.github.com/repos/nitlang/nit/issues/2021/comments"},"review_comments":{"href":"https://api.github.com/repos/nitlang/nit/pulls/2021/comments"},"review_comment":{"href":"https://api.github.com/repos/nitlang/nit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nitlang/nit/pulls/2021/commits"},"statuses":{"href":"https://api.github.com/repos/nitlang/nit/statuses/e08de594124439847cb22691ba6a15adfe11641b"}}}}