Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maybe not use unicode characters in yes_no ? #566

Closed
cderv opened this issue Jan 8, 2021 · 5 comments
Closed

maybe not use unicode characters in yes_no ? #566

cderv opened this issue Jan 8, 2021 · 5 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@cderv
Copy link
Collaborator

cderv commented Jan 8, 2021

yes_no() uses readline() and it seems to not handle well Unicode characters on Windows at least. (not like cat())

I got this in R console

― The new site is ready
○ To start a local preview: use blogdown::serve_site(), or the RStudio add-in "Serve Site"
○ To stop a local preview: use blogdown::stop_server(), or restart your R session
<U+25BA> Want to serve and preview the site now? (y/n) 

Does it print ok for you ? Is this a R console config issue on Windows ?

@cderv cderv added the bug an unexpected problem or unintended behavior label Jan 8, 2021
@yihui
Copy link
Member

yihui commented Jan 8, 2021

Okay, I felt we would run into this sooner or later on Windows (macOS and Linux should be fine). The unicode characters seem to work with cat(). I'll see what I can do. Thanks!

@yihui yihui closed this as completed in 9d2d2f7 Jan 8, 2021
@yihui
Copy link
Member

yihui commented Jan 8, 2021

Now it will fall back on > if is not supported. Thanks!

@cderv
Copy link
Collaborator Author

cderv commented Jan 8, 2021

Thanks !

I observed that : cat() is fine, print also, just not readline. Not sure which is the difference.

[usethis-create-proj*] > cat("\u25ba")
►
[usethis-create-proj*] > print("\u25ba")
[1] ""
[usethis-create-proj*] > readline("\u25ba")
<U+25BA>
[1] ""

@yihui
Copy link
Member

yihui commented Jan 8, 2021

Here is the hope: https://developer.r-project.org/Blog/public/2020/07/30/windows/utf-8-build-of-r-and-cran-packages/

This problem has existed for long, e.g. r-lib/evaluate#59 and many other issues that referenced to it.

@cderv
Copy link
Collaborator Author

cderv commented Jan 8, 2021

Thanks for sharing - I understand now.

So many things in the history of your work ! It is really interesting for me to learn all this. Thanks for taking the time to share it with me, ... with my questions and ideas that you already encountered years ago 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants