{"action":"created","issue":{"url":"https://api.github.com/repos/rstudio/htmltools/issues/20","labels_url":"https://api.github.com/repos/rstudio/htmltools/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/rstudio/htmltools/issues/20/comments","events_url":"https://api.github.com/repos/rstudio/htmltools/issues/20/events","html_url":"https://github.com/rstudio/htmltools/pull/20","id":53575150,"number":20,"title":"convert the encoding to UTF-8 before writing out the content","user":{"login":"yihui","id":163582,"avatar_url":"https://avatars.githubusercontent.com/u/163582?v=3","gravatar_id":"","url":"https://api.github.com/users/yihui","html_url":"https://github.com/yihui","followers_url":"https://api.github.com/users/yihui/followers","following_url":"https://api.github.com/users/yihui/following{/other_user}","gists_url":"https://api.github.com/users/yihui/gists{/gist_id}","starred_url":"https://api.github.com/users/yihui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yihui/subscriptions","organizations_url":"https://api.github.com/users/yihui/orgs","repos_url":"https://api.github.com/users/yihui/repos","events_url":"https://api.github.com/users/yihui/events{/privacy}","received_events_url":"https://api.github.com/users/yihui/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-01-06T23:03:07Z","updated_at":"2015-01-09T03:14:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rstudio/htmltools/pulls/20","html_url":"https://github.com/rstudio/htmltools/pull/20","diff_url":"https://github.com/rstudio/htmltools/pull/20.diff","patch_url":"https://github.com/rstudio/htmltools/pull/20.patch"},"body":"Without the conversion, multi-byte characters do not work in HTML widgets. I have tested it with the DT package.\r\n\r\nThis fixes the third issue reported at rstudio/shiny-examples#2."},"comment":{"url":"https://api.github.com/repos/rstudio/htmltools/issues/comments/69287774","html_url":"https://github.com/rstudio/htmltools/pull/20#issuecomment-69287774","issue_url":"https://api.github.com/repos/rstudio/htmltools/issues/20","id":69287774,"user":{"login":"yihui","id":163582,"avatar_url":"https://avatars.githubusercontent.com/u/163582?v=3","gravatar_id":"","url":"https://api.github.com/users/yihui","html_url":"https://github.com/yihui","followers_url":"https://api.github.com/users/yihui/followers","following_url":"https://api.github.com/users/yihui/following{/other_user}","gists_url":"https://api.github.com/users/yihui/gists{/gist_id}","starred_url":"https://api.github.com/users/yihui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yihui/subscriptions","organizations_url":"https://api.github.com/users/yihui/orgs","repos_url":"https://api.github.com/users/yihui/repos","events_url":"https://api.github.com/users/yihui/events{/privacy}","received_events_url":"https://api.github.com/users/yihui/received_events","type":"User","site_admin":false},"created_at":"2015-01-09T03:14:10Z","updated_at":"2015-01-09T03:14:10Z","body":"Okay, I did not know it had been done in history, and writeChar() could be so much faster. I guess `enc2utf8('hi')` is not a realistic example since it is purely ASCII. I tried this instead (with my Core i7 Linux):\r\n\r\n```r\r\nx = c(\"\\u4E11\", \"\\300\", \"œ\", 'o')\r\nsystem.time(for (i in 1:1000000) enc2utf8(x))\r\n#    user  system elapsed \r\n#  1.382   0.000   1.323 \r\n```\r\n\r\nI guess it should not be a real issue since it is unlikely that someone needs to render so many tags. Anyway, could you submit your patch as a new PR? I can test it on Rmd/htmlwidgets examples to see if it really makes a difference. Thanks!"}}