I try to set my default encoding to UTF-8; up to now without success:
a <- \"Hallo\"
b <- \"äöfd\"
print(Encoding(a))
# [1] \"unknown\"
print(Encoding(
This is not a perfect answer but a good workaround: As Roland pointed out, it might be dangerous to change the locale. So leave it as is. If you have a file and you run into trouble, just search for non-UTF8 encoding as discribed here for RStudio
. What I saw, most Editors have such a feature.
Furthermore, this answer gives more insight in what you can do in case you source()
a file.
For a way to deal with locales when collations play a crucial part see here