<div dir="ltr"><div>this looks like a bug to me. thanks for reporting, marcis! note that your testdf1 does not throw an error, only testdf2 does.<br><br>hannes, i am using monetdb.r 1.0.0 - here is the script and below it the output.<br><br></div>note it does create the table even though it returned an error, which also should not happen?<br><div><br></div><div>what do you think?<br></div><div><br><br><br>library(MonetDB.R)<br>sessionInfo()<br>conn <- dbConnect(MonetDB.R(), "monetdb://localhost/demo")<br>testDf2 <- data.frame(test = '€', stringsAsFactors = FALSE)<br>Encoding(testDf2$test) <- 'UTF-8'<br><br># this throws an error<br>dbWriteTable(conn, "testdf2", testDf2)<br><br><br># AND the table is now in the database! which should not happen<br>dbListTables( conn )<br><br><br><br><br><br><br><br><br><br>> library(MonetDB.R)<br>> sessionInfo()<br>R version 3.2.2 (2015-08-14)<br>Platform: i386-w64-mingw32/i386 (32-bit)<br>Running under: Windows 8 x64 (build 9200)<br><br>locale:<br>[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 <br>[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C <br>[5] LC_TIME=English_United States.1252 <br><br>attached base packages:<br>[1] stats graphics grDevices utils datasets methods base <br><br>other attached packages:<br>[1] MonetDB.R_1.0.0 DBI_0.3.1 <br><br>loaded via a namespace (and not attached):<br>[1] tools_3.2.2 codetools_0.2-14 digest_0.6.8 <br>> conn <- dbConnect(MonetDB.R(), "monetdb://localhost/demo")<br>> testDf2 <- data.frame(test = '€', stringsAsFactors = FALSE)<br>> Encoding(testDf2$test) <- 'UTF-8'<br>> <br>> # this throws an error<br>> dbWriteTable(conn, "testdf2", testDf2)<br>Error in if (chr == "\n") f <- qs <- paste0(qs, "\\", "n") : <br> missing value where TRUE/FALSE needed<br>In addition: Warning message:<br>In strsplit(str, "", fixed = TRUE) : input string 1 is invalid UTF-8<br>> <br>> <br>> # AND the table is now in the database! which should not happen<br>> dbListTables( conn )<br>[1] "testdf2"<br>> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 24, 2015 at 6:20 AM, Mārcis Bratka <span dir="ltr"><<a href="mailto:marcis.bratka@gmail.com" target="_blank">marcis.bratka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Tried version 1.0 and encoding UTF-8, but no luck <br><br>testDf1 <- data.frame(test = 'āčēģļč', stringsAsFactors = FALSE)<br>testDf2 <- data.frame(test = '€', stringsAsFactors = FALSE)<br>testDf3 <- data.frame(test = 'qwerty', stringsAsFactors = FALSE)<br><br>Encoding(testDf1$test) <- 'UTF-8'<br>Encoding(testDf2$test) <- 'UTF-8'<br><br><pre style="font-family:Consolas;font-size:8pt!important;outline:medium none;border:medium none;margin:0px;white-space:pre-wrap!important;line-height:12px;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)"><span style="color:blue;white-space:pre-wrap">> </span><span style="color:blue">Encoding(testDf1$test)
</span>[1] "UTF-8"
<span style="color:blue;white-space:pre-wrap">> </span><span style="color:blue">testDf1$test
</span>[1] "\xe2\xe8\xe7\xec\xef\xe8"
<span style="color:blue;white-space:pre-wrap">> </span><span style="color:blue">Encoding(testDf2$test)
</span>[1] "UTF-8"
<span style="color:blue;white-space:pre-wrap">> </span><span style="color:blue">testDf2$test
</span>[1] "\u0080"</pre><br>dbWriteTable(conn, "testdf1", testDf1) # error<br>dbWriteTable(conn, "testdf2", testDf2) # error<br>dbWriteTable(conn, "testdf3", testDf3) # works<br><br><pre style="font-family:Consolas;font-size:8pt!important;outline:medium none;border:medium none;margin:0px;white-space:pre-wrap!important;line-height:12px;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)"><span style="color:rgb(197,6,11)">Error in if (chr == "\n") f <- qs <- paste0(qs, "\\", "n") :
missing value where TRUE/FALSE needed
</span><span style="color:rgb(197,6,11)">In addition: </span><span style="color:rgb(197,6,11)">Warning message:
</span><span style="color:rgb(197,6,11)">In strsplit(str, "", fixed = TRUE) :</span><span style="color:rgb(197,6,11)"> input string 1 is invalid UTF-8</span></pre><br><br></div>Thanks<br></div>Marcis<br><div><div><br><br><br><br><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-10-24 10:50 GMT+03:00 Anthony Damico <span dir="ltr"><<a href="mailto:ajdamico@gmail.com" target="_blank">ajdamico@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">i believe the problem is that € is latin encoding and monetdb needs UTF-8 encoding?<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Fri, Oct 23, 2015 at 3:46 PM, Mārcis Bratka <span dir="ltr"><<a href="mailto:marcis.bratka@gmail.com" target="_blank">marcis.bratka@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div>Hi,<br><br></div>does MonetDB.R support non ascii characters? I get error when running following lines:<br><div><div><br>testDf1 <- data.frame(test = 'āčēģļč')<br>testDf2 <- data.frame(test = '€')<br><br>dbWriteTable(conn, "testDf1", testDf1)<br>dbWriteTable(conn, "testDf2", testDf2)<br><br><br><pre style="font-family:Consolas;font-size:8pt!important;outline:medium none;border:medium none;margin:0px;white-space:pre-wrap!important;line-height:12px;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)"><span style="color:rgb(197,6,11)">Error in .local(conn, statement, ...) :
Unable to execute statement 'INSERT INTO testDf2 VALUES ('€')'.
Server says '!invalid start of UTF-8 sequence'.</span></pre><br><br></div><div><pre style="font-family:Consolas;font-size:8pt!important;outline:medium none;border:medium none;margin:0px;white-space:pre-wrap!important;line-height:12px;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)">R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Latvian_Latvia.1257 LC_CTYPE=Latvian_Latvia.1257 LC_MONETARY=Latvian_Latvia.1257
[4] LC_NUMERIC=C LC_TIME=Latvian_Latvia.1257
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readr_0.2.1 dplyr_0.4.3 MonetDB.R_0.9.7 digest_0.6.8 DBI_0.3.1
loaded via a namespace (and not attached):
[1] lazyeval_0.1.10 magrittr_1.5 R6_2.1.1 assertthat_0.1 parallel_3.2.2 tools_3.2.2
[7] Rcpp_0.12.1 </pre><br><br></div><div>Thanks<br></div><div>Marcis<br></div></div></div>
<br></div></div><span>_______________________________________________<br>
Monetr-users mailing list<br>
<a href="mailto:Monetr-users@lists.r-forge.r-project.org" target="_blank">Monetr-users@lists.r-forge.r-project.org</a><br>
<a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/monetr-users" rel="noreferrer" target="_blank">http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/monetr-users</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>