{"action":"created","issue":{"url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/161","labels_url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/161/labels{/name}","comments_url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/161/comments","events_url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/161/events","html_url":"https://github.com/tomassedovic/tcod-rs/pull/161","id":84939628,"number":161,"title":"Use `u8` and `[u8]`, not `char` and `str` for printing methods on `Console`","user":{"login":"P1start","id":2055302,"avatar_url":"https://avatars.githubusercontent.com/u/2055302?v=3","gravatar_id":"","url":"https://api.github.com/users/P1start","html_url":"https://github.com/P1start","followers_url":"https://api.github.com/users/P1start/followers","following_url":"https://api.github.com/users/P1start/following{/other_user}","gists_url":"https://api.github.com/users/P1start/gists{/gist_id}","starred_url":"https://api.github.com/users/P1start/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/P1start/subscriptions","organizations_url":"https://api.github.com/users/P1start/orgs","repos_url":"https://api.github.com/users/P1start/repos","events_url":"https://api.github.com/users/P1start/events{/privacy}","received_events_url":"https://api.github.com/users/P1start/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-06-04T06:25:21Z","updated_at":"2015-06-04T12:06:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/161","html_url":"https://github.com/tomassedovic/tcod-rs/pull/161","diff_url":"https://github.com/tomassedovic/tcod-rs/pull/161.diff","patch_url":"https://github.com/tomassedovic/tcod-rs/pull/161.patch"},"body":"`Console`’s printing methods don’t work with Unicode strings or characters, so it doesn’t make sense to use the `char` (Unicode scalar value) and `str` (UTF-8 string) types. This changes these methods to use `u8` and `[u8]` instead. The ergonomic impact of this is minimal (although it breaks just about all code, unfortunately), due to the existence of byte string and character literals (`b\"foo\"` and `b'c'`), and additionally, this makes it possible to specify special characters directly inside byte strings (e.g., printing `b\"90\\xf8\"` (`0xf8` is [`chars::GRADE`](https://tomassedovic.github.io/tcod-rs/tcod/chars/constant.GRADE.html)) now displays `90°`, but previously displayed `90├©` due to the fact that strings are UTF-8)."},"comment":{"url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/comments/108863572","html_url":"https://github.com/tomassedovic/tcod-rs/pull/161#issuecomment-108863572","issue_url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/161","id":108863572,"user":{"login":"Gustorn","id":2189776,"avatar_url":"https://avatars.githubusercontent.com/u/2189776?v=3","gravatar_id":"","url":"https://api.github.com/users/Gustorn","html_url":"https://github.com/Gustorn","followers_url":"https://api.github.com/users/Gustorn/followers","following_url":"https://api.github.com/users/Gustorn/following{/other_user}","gists_url":"https://api.github.com/users/Gustorn/gists{/gist_id}","starred_url":"https://api.github.com/users/Gustorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gustorn/subscriptions","organizations_url":"https://api.github.com/users/Gustorn/orgs","repos_url":"https://api.github.com/users/Gustorn/repos","events_url":"https://api.github.com/users/Gustorn/events{/privacy}","received_events_url":"https://api.github.com/users/Gustorn/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T12:06:03Z","updated_at":"2015-06-04T12:06:03Z","body":"Yeah, unfortunaly that is a valid example. These are the times when I actually miss C++. A templated print wouldn't cause any problems there.\r\n\r\nI still think that using `u8` as default is not the greatest idea: it does have a significant ergonomic impact (either the byte literals or `as_bytes` (?)), and it's much more natural to work with `String` and `&str`. An other option would be to get rid of every function inside the trait (except for `con`), and define everything as free functions. Since there's no actual UFCS in Rust, this would be pretty inconvenient (even though it would mirror the C API quite faithfully):\r\n\r\n```rust\r\nroot.print(args...); \r\n// Would become\r\nconsole::print(root, args...);\r\n```"}}