Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Printing unicode hex characters

My data contains strings with unicode hex characters like this character "En Dash", basically a hyphen.

str = "foo – bar"

Is there any way to make this print nicely in R, for example via cat()? I’ve tried a couple of unicode decoders to no effect.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I found that the unicode of endash is U+2013

So you can use the unicode and cat to display the endash character

message <-"foo \U2013 bar"

cat(message)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading