This is a condensed version of the same question on stackexchange here:
http://stackoverflow.com/questions/18789330/r-on-windows-character-encoding-hell
If you've already stumbled upon it feel free to ignore.

My problem is that R on US Windows does not read *any* text file that
contains *any* foreign characters. It simply reads the first consecutive n
ASCII characters and then throws a warning once it reached a foreign
character:

> test <- read.table("test.txt", sep=";", dec=",", quote="",
fileEncoding="UTF-8")
Warning messages:
1: In read.table("test.txt", sep = ";", dec = ",", quote = "", fileEncoding
= "UTF-8") :
  invalid input found on input connection 'test.txt'
2: In read.table("test.txt", sep = ";", dec = ",", quote = "", fileEncoding
= "UTF-8") :
  incomplete final line found by readTableHeader on 'test.txt'
> print(test)
       V1
1 english

> Sys.getlocale()
   [1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;
     LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"


It is important to note that that R on linux will read UTF-8 as well as
exotic character sets without a problem. I've tried it with the exact same
files (one was UTF-8 and another was OEM866 Cyrillic).

If I do not include the fileEncoding parameter, read.table will read the
whole CSV file. But naturally it will read it wrong because it does not
know the encoding. So whenever I try to specify the fileEncoding, R will
throw the warnings and stop once it reaches a foreign character. It's the
same story with all international character encodings.
Other users on stackexchange have reported exactly the same issue.


Is anyone here who is on a US version of Windows able to import files with
foreign characters? Please let me know.

Thank you,
Max

	[[alternative HTML version deleted]]

