{"action":"created","issue":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/6733","repository_url":"https://api.github.com/repos/crystal-lang/crystal","labels_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6733/labels{/name}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6733/comments","events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6733/events","html_url":"https://github.com/crystal-lang/crystal/issues/6733","id":360623408,"node_id":"MDU6SXNzdWUzNjA2MjM0MDg=","number":6733,"title":"'print' and 'puts' are unable to print specific characters","user":{"login":"r00ster91","id":35064754,"node_id":"MDQ6VXNlcjM1MDY0NzU0","avatar_url":"https://avatars3.githubusercontent.com/u/35064754?v=4","gravatar_id":"","url":"https://api.github.com/users/r00ster91","html_url":"https://github.com/r00ster91","followers_url":"https://api.github.com/users/r00ster91/followers","following_url":"https://api.github.com/users/r00ster91/following{/other_user}","gists_url":"https://api.github.com/users/r00ster91/gists{/gist_id}","starred_url":"https://api.github.com/users/r00ster91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r00ster91/subscriptions","organizations_url":"https://api.github.com/users/r00ster91/orgs","repos_url":"https://api.github.com/users/r00ster91/repos","events_url":"https://api.github.com/users/r00ster91/events{/privacy}","received_events_url":"https://api.github.com/users/r00ster91/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-16T09:54:29Z","updated_at":"2018-09-16T11:00:29Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Doing this (or `puts`):\r\n```cr\r\nSTDOUT.puts \"\\xEC\"\r\n```\r\nresults in:\r\n```cr\r\nUnhandled exception: Error writing file: Input/output error (Errno)\r\n  from /usr/share/crystal/src/crystal/system/unix/file_descriptor.cr:77:13 in 'unbuffered_write'\r\n  from /usr/share/crystal/src/io/buffered.cr:205:5 in 'flush'\r\n  from /usr/share/crystal/src/io/buffered.cr:166:7 in 'write_byte'\r\n  from /usr/share/crystal/src/char.cr:767:9 in 'to_s'\r\n  from /usr/share/crystal/src/io.cr:184:5 in '<<'\r\n  from /usr/share/crystal/src/io.cr:198:5 in 'print'\r\n  from /usr/share/crystal/src/io.cr:253:5 in 'puts'\r\n  from /usr/share/crystal/src/io.cr:228:5 in 'puts'\r\n  from test.cr:1:1 in '__crystal_main'\r\n  from /usr/share/crystal/src/crystal/main.cr:97:5 in 'main_user_code'\r\n  from /usr/share/crystal/src/crystal/main.cr:86:7 in 'main'\r\n  from /usr/share/crystal/src/crystal/main.cr:106:3 in 'main'\r\n  from __libc_start_main\r\n  from _start\r\n  from ???\r\nFailed to raise an exception: END_OF_STACK\r\n[0x448d66] *CallStack::print_backtrace:Int32 +118\r\n[0x4310e6] __crystal_raise +86\r\n[0x45a7c0] *IO::FileDescriptor +1104\r\n[0x45ab69] *IO::FileDescriptor +89\r\n[0x48528c] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +156\r\n[0x43bd56] main +6\r\n[0x7ff428740830] __libc_start_main +240\r\n[0x4306f9] _start +41\r\n[0x0] ???\r\n```\r\n\r\n-----\r\n\r\nOr doing this:\r\n```cr\r\nSTDOUT.print \"\\xEC\"\r\n```\r\nresults in:\r\n```cr\r\nFailed to raise an exception: END_OF_STACK\r\n[0x448d66] *CallStack::print_backtrace:Int32 +118\r\n[0x4310e6] __crystal_raise +86\r\n[0x45a7c0] *IO::FileDescriptor +1104\r\n[0x45ab69] *IO::FileDescriptor +89\r\n[0x48528c] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +156\r\n[0x43bd56] main +6\r\n[0x7f8932d40830] __libc_start_main +240\r\n[0x4306f9] _start +41\r\n[0x0] ???\r\n```\r\nwhile this (so with `STDOUT.flush` after `STDOUT.print`):\r\n```cr\r\nprint \"\\xEC\"\r\n```\r\nresults in:\r\n```cr\r\nUnhandled exception: Error writing file: Input/output error (Errno)\r\n  from /usr/share/crystal/src/crystal/system/unix/file_descriptor.cr:77:13 in 'unbuffered_write'\r\n  from /usr/share/crystal/src/io/buffered.cr:205:5 in 'flush'\r\n  from /usr/share/crystal/src/kernel.cr:51:3 in 'print'\r\n  from test.cr:1:1 in '__crystal_main'\r\n  from /usr/share/crystal/src/crystal/main.cr:97:5 in 'main_user_code'\r\n  from /usr/share/crystal/src/crystal/main.cr:86:7 in 'main'\r\n  from /usr/share/crystal/src/crystal/main.cr:106:3 in 'main'\r\n  from __libc_start_main\r\n  from _start\r\n  from ???\r\nFailed to raise an exception: END_OF_STACK\r\n[0x448df6] *CallStack::print_backtrace:Int32 +118\r\n[0x431116] __crystal_raise +86\r\n[0x45a850] *IO::FileDescriptor +1104\r\n[0x45abf9] *IO::FileDescriptor +89\r\n[0x48531c] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +156\r\n[0x43bd86] main +6\r\n[0x7f4d63540830] __libc_start_main +240\r\n[0x430729] _start +41\r\n[0x0] ???\r\n```\r\n\r\n### It happens with the following characters:\r\n   - `\\xEC`\r\n   - `\\x8B`\r\n   - `\\xC1`\r\n\r\n#### There might be more.\r\n\r\nBut for example printing these mysterious characters with `printf`, `sprintf`, `LibC.printf` or `LibC.puts` does not result in any error.\r\n\r\nI came across these errors when I printed out the binary of an executable.\r\n```\r\nCrystal 0.26.1 [391785249] (2018-08-27)\r\n\r\nLLVM: 4.0.0\r\nDefault target: x86_64-unknown-linux-gnu\r\n```\r\nI'm using the Windows Subsystem for Linux."},"comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments/421745530","html_url":"https://github.com/crystal-lang/crystal/issues/6733#issuecomment-421745530","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6733","id":421745530,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTc0NTUzMA==","user":{"login":"straight-shoota","id":466378,"node_id":"MDQ6VXNlcjQ2NjM3OA==","avatar_url":"https://avatars0.githubusercontent.com/u/466378?v=4","gravatar_id":"","url":"https://api.github.com/users/straight-shoota","html_url":"https://github.com/straight-shoota","followers_url":"https://api.github.com/users/straight-shoota/followers","following_url":"https://api.github.com/users/straight-shoota/following{/other_user}","gists_url":"https://api.github.com/users/straight-shoota/gists{/gist_id}","starred_url":"https://api.github.com/users/straight-shoota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/straight-shoota/subscriptions","organizations_url":"https://api.github.com/users/straight-shoota/orgs","repos_url":"https://api.github.com/users/straight-shoota/repos","events_url":"https://api.github.com/users/straight-shoota/events{/privacy}","received_events_url":"https://api.github.com/users/straight-shoota/received_events","type":"User","site_admin":false},"created_at":"2018-09-16T11:00:29Z","updated_at":"2018-09-16T11:00:29Z","author_association":"CONTRIBUTOR","body":"I doubt this is a Crystal issue, though."}}
{"actor":{"display_login":"straight-shoota"}}