{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/14158","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/14158/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/14158/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/14158/events","html_url":"https://github.com/JuliaLang/julia/issues/14158","id":119083471,"number":14158,"title":"Invalid second UTF8String indices don't cause errors","user":{"login":"JobJob","id":854183,"avatar_url":"https://avatars.githubusercontent.com/u/854183?v=3","gravatar_id":"","url":"https://api.github.com/users/JobJob","html_url":"https://github.com/JobJob","followers_url":"https://api.github.com/users/JobJob/followers","following_url":"https://api.github.com/users/JobJob/following{/other_user}","gists_url":"https://api.github.com/users/JobJob/gists{/gist_id}","starred_url":"https://api.github.com/users/JobJob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JobJob/subscriptions","organizations_url":"https://api.github.com/users/JobJob/orgs","repos_url":"https://api.github.com/users/JobJob/repos","events_url":"https://api.github.com/users/JobJob/events{/privacy}","received_events_url":"https://api.github.com/users/JobJob/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":31,"created_at":"2015-11-26T17:31:01Z","updated_at":"2015-12-01T22:08:27Z","closed_at":null,"body":"    s = \"🛀🛀\" #a bath codepoint is 4 bytes long\r\n    s12 = s[1:2] # \"🛀\"\r\n    s56 = s[5:6] # \"?\" #the expected behaviour is this should be the same as s12?\r\n    sizeof(s12)  # 4\r\n    sizeof(s56)  # 2\r\n\r\nThe issue seems to be that:\r\n\r\n    nextind(s, 2) # 5\r\n    nextind(s, 6) # 7 (prob should be 9)\r\n\r\nI tried changing https://github.com/JuliaLang/julia/blob/master/base/strings/basic.jl#L141 to \r\n\r\n    return sizeof(s)+1\r\n\r\nand it seems to fix the problem. Additionally `julia5 runtests.jl unicode string strings/basic strings/io strings/search strings/types strings/util` succeeds after making this change and recompiling.\r\n\r\nShould I add some tests and submit a PR?"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/161110908","html_url":"https://github.com/JuliaLang/julia/issues/14158#issuecomment-161110908","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/14158","id":161110908,"user":{"login":"JobJob","id":854183,"avatar_url":"https://avatars.githubusercontent.com/u/854183?v=3","gravatar_id":"","url":"https://api.github.com/users/JobJob","html_url":"https://github.com/JobJob","followers_url":"https://api.github.com/users/JobJob/followers","following_url":"https://api.github.com/users/JobJob/following{/other_user}","gists_url":"https://api.github.com/users/JobJob/gists{/gist_id}","starred_url":"https://api.github.com/users/JobJob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JobJob/subscriptions","organizations_url":"https://api.github.com/users/JobJob/orgs","repos_url":"https://api.github.com/users/JobJob/repos","events_url":"https://api.github.com/users/JobJob/events{/privacy}","received_events_url":"https://api.github.com/users/JobJob/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T22:08:27Z","updated_at":"2015-12-01T22:08:27Z","body":"Honestly, it's funny you say that because the same thing happened to me :)\r\n\r\nI actually started implementing it originally as per your current plan, and wrote the tests in the PR (that chop and chomp fail on) after seeing these potential bugs (if end indices have to pass `isvalid`), and then I saw that it was sort of assumed in a few places that `s[i:j]` is ok if `j` is the last byte of a code point (was focussed on utf8), and I thought you know what, changing this is probably quite a big change, and thus came to the view expressed above :)"}}