Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding Issue with Windows and Daff #26

Open
michaelgasser opened this issue Aug 21, 2018 · 1 comment
Open

Encoding Issue with Windows and Daff #26

michaelgasser opened this issue Aug 21, 2018 · 1 comment

Comments

@michaelgasser
Copy link

I am experiencing encoding problems which I believe are a combined issue of Windows and render_diff's way of generating the html file.

render_diff seems to be generating the html file by setting the encoding to utf-8 as standard. On windows machines, this does not seem to work, as the data written to the disk is encoded as ANSI.

My workaround has been to change the encoding details in the html-file:

render_diff(changes, file = write_file, view = FALSE)

# reopen file and replace encoding details
x <- readLines(write_file)
y <- gsub( "<meta charset='utf-8'>", "<meta charset='ANSI'>", x )
cat(y, file=write_file, sep="\n")

While it works, it might be nice to have this fixed, since daff is very useful. I have not been able to identify the exact location of the bug, hence this description.

Here is an example on Windows (Daff v0.3.0):

df1 <- data.frame(x = "ä", y = "è")
df2 <- data.frame(x = "ö", y = "è")
diff <- diff_data(df1, df2)
render_diff(diff)

image

@j-c-o-l-l-i-n-s
Copy link

This appears to be derived from the use of sQuote here:

title <- paste(sQuote(s$source_name), "vs.", sQuote(s$target_name))`

A simple solution to this (although @michaelgasser's solution certainly does the trick) is to override the default quoting behavior before running render_diff via options(useFancyQuotes = F) as mentioned in the sQuote documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants