You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could you please test your files with encoding = "UTF-8" or "Latin-1" and write back as to whether it solves the issue (especially on windows)? Thanks.
About the fix:
Looking at read.table() function, the encoding is set upfront with Encoding(..) <- .... And looking at the source of Encoding<-, it calls an internal function do_setencoding. Looking at the source of that function, https://github.com/wch/r-source/blob/ca5348f0b5e3f3c2b24851d7aff02de5217465eb/src/main/util.c#L1115, it seems quite straightforward to fix this (I think).. through the use of mkCharLenCE function that R's C-API seems to expose.
fread() gains a new argument encoding with valid values unknown, UTF-8 and Latin-1. The default behaviour hasn't changed. Windows user will have to set the encoding argument explicitly. This could change in the future (perhaps also testing for performance hit would be a deciding factor).
A question of clarification: does the encoding option in fread just set the marked encoding, or does it convert from what you've declared to the system's native encoding?
I have an iso-8850-1 windows file, that I can't fread correctly on linux. This workaround (#563 (comment)) works. And read.csv works (i.e. produces the correct øæå letters, instead of e.g. \xe6), but fread(... encoding = "Latin-1") does not.
Activity
EDiLD2 commentedon Sep 24, 2014
+1 for this
bnbwn commentedon Nov 17, 2014
+1
stanasa commentedon Dec 28, 2014
+1
sirvydasdagys commentedon Feb 11, 2015
+1
harmonica2 commentedon Mar 12, 2015
+1
zeltak commentedon Mar 16, 2015
+1
MarcinKosinski commentedon Mar 16, 2015
+1
grgurev commentedon Mar 18, 2015
+1
lucarno commentedon Mar 24, 2015
+1
seyedamo commentedon Apr 9, 2015
+1
jcizel commentedon Apr 9, 2015
+1
Alectoria commentedon Apr 13, 2015
+1
tophcito commentedon Apr 16, 2015
+1
clarkdk commentedon Apr 29, 2015
+1
8 remaining items
panda2727 commentedon Jun 17, 2015
+1
duf59 commentedon Aug 7, 2015
+1
romunov commentedon Aug 7, 2015
+1
note however that in
?Encoding,UTF-8is used (notUTF8).rentrop commentedon Aug 22, 2015
+1
leoluyi commentedon Aug 24, 2015
+1
Added another test for fread encoding, #563.
arunsrinivasan commentedon Aug 25, 2015
Tl;dr
Could you please test your files with
encoding = "UTF-8"or"Latin-1"and write back as to whether it solves the issue (especially on windows)? Thanks.About the fix:
Looking at
read.table()function, the encoding is set upfront withEncoding(..) <- .... And looking at the source ofEncoding<-, it calls an internal functiondo_setencoding. Looking at the source of that function, https://github.com/wch/r-source/blob/ca5348f0b5e3f3c2b24851d7aff02de5217465eb/src/main/util.c#L1115, it seems quite straightforward to fix this (I think).. through the use ofmkCharLenCEfunction that R's C-API seems to expose.fread()gains a new argumentencodingwith valid valuesunknown,UTF-8andLatin-1. The default behaviour hasn't changed. Windows user will have to set the encoding argument explicitly. This could change in the future (perhaps also testing for performance hit would be a deciding factor).More direct fix for #563, since mkCharLen internally call mkCharLenCE.
clarkdk commentedon Aug 31, 2015
Arun, There's a typo in README.md
27 . fread() gains eocnding argument. ... eocnding --> encoding
jangorecki commentedon Aug 31, 2015
if speaking about the typos there is one missing
()next toflush.consoleinbmergefunction:data.table/R/bmerge.R
Line 102 in 7f78b1b
dbuijs commentedon Sep 1, 2015
Thank you for this!!!!
A question of clarification: does the
encodingoption infreadjust set the marked encoding, or does it convert from what you've declared to the system's native encoding?andreasio commentedon Jun 21, 2016
I have an iso-8850-1 windows file, that I can't fread correctly on linux. This workaround (#563 (comment)) works. And read.csv works (i.e. produces the correct øæå letters, instead of e.g. \xe6), but fread(... encoding = "Latin-1") does not.