{"action":"closed","issue":{"url":"https://api.github.com/repos/tbodt/ish/issues/235","repository_url":"https://api.github.com/repos/tbodt/ish","labels_url":"https://api.github.com/repos/tbodt/ish/issues/235/labels{/name}","comments_url":"https://api.github.com/repos/tbodt/ish/issues/235/comments","events_url":"https://api.github.com/repos/tbodt/ish/issues/235/events","html_url":"https://github.com/tbodt/ish/issues/235","id":394890039,"node_id":"MDU6SXNzdWUzOTQ4OTAwMzk=","number":235,"title":"selecting text on screen will copy displayed 'space' as unicode 0x00A0","user":{"login":"francoisvignon","id":45739858,"node_id":"MDQ6VXNlcjQ1NzM5ODU4","avatar_url":"https://avatars3.githubusercontent.com/u/45739858?v=4","gravatar_id":"","url":"https://api.github.com/users/francoisvignon","html_url":"https://github.com/francoisvignon","followers_url":"https://api.github.com/users/francoisvignon/followers","following_url":"https://api.github.com/users/francoisvignon/following{/other_user}","gists_url":"https://api.github.com/users/francoisvignon/gists{/gist_id}","starred_url":"https://api.github.com/users/francoisvignon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francoisvignon/subscriptions","organizations_url":"https://api.github.com/users/francoisvignon/orgs","repos_url":"https://api.github.com/users/francoisvignon/repos","events_url":"https://api.github.com/users/francoisvignon/events{/privacy}","received_events_url":"https://api.github.com/users/francoisvignon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-30T17:57:36Z","updated_at":"2018-12-30T20:44:43Z","closed_at":"2018-12-30T20:44:43Z","author_association":"NONE","body":"when selecting text containing space on iSH window (in example, the command \"echo a\") and then copying, the space between o and a is encoded as unicode 00A0 and this value is stored into clipboard.\r\nSo, when pasting the copied text, result is pasting \"echo a\", but the space between o and a is not a space (ascii 32) but a space (ascii/unicode 0x00A0)\r\n\r\nas in this sample:\r\n```\r\niFv:~# echo a                                 \r\na                      \r\niFv:~# ( now, select above 'echo a', then copy and then past) \r\niFv:~# echo a                                  \r\n-ash: echo a: not found           ( because it's not a space - ascii 32 - between o and a )             \r\niFv:~# \r\n```\r\n\r\nthe solution can be the following:\r\n```\r\n- (void)copy:(id)sender {\r\n    [self.terminal.webView evaluateJavaScript:@\"window.getSelection().toString()\" completionHandler:^(NSString *selection, NSError *err) {\r\n        if (err != nil) {\r\n            NSLog(@\"error copying: %@\", err);\r\n            return;\r\n        }\r\n        UIPasteboard.generalPasteboard.string = [selection stringByReplacingOccurrencesOfString:@\"\\u00A0\" withString:@\" \"];\r\n    }];\r\n}\r\n```\r\nwhen copying into clipboard, replace all occurence of unicode strings \"\\u00A0\" by \" \" (I think my solution is not the good one, but at least, it work)\r\n\r\n<!--\r\nIf you're reporting a crash, please include a crash dump. You can find them in Settings > Privacy > Diagnostics and Usage.\r\nIf this is a \"Bad system call\", \"Illegal instruction\", or \"Segmentation fault\", run `dmesg` to get a dump of the log messages and include the relevant output.\r\n-->\r\n"}}
{"actor":{"display_login":"tbodt"}}