I use a Windows PC in the Office, a MacBook at home, and a Linux PC in the lab (I have my reasons in each case). I use Dropbox to synchronise my code across machines. Occasionally, I have cause to use a slightly unusual symbol in my code. For example, plotting a graph in R using a degree sign (°
). If I save the file on the Mac and open it on the PC, the character has now rendered as '°
'. If I change this back to the °
symbol on PC, when I return to the MacBook, it renders as a '?
', and R refuses to run the code.
This is not exclusive to R; I have noticed this in MATLAB as well, often with similar characters. These just happen to be the two languages I do most of my work in. I understand that this probably has something to do with file encoding, but I have no idea how to make sure (at least for R and MATLAB) that I save in a compatible format. Avoiding the use of these characters is obviously one option, but is hardly ideal.
Is there a solution to this issue, either universally, or at least for R and MATLAB?