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

tbl() returns locale error #339

Closed
dichika opened this issue Mar 20, 2014 · 4 comments
Closed

tbl() returns locale error #339

dichika opened this issue Mar 20, 2014 · 4 comments

Comments

@dichika
Copy link

dichika commented Mar 20, 2014

Here's the test data.

colnames(iris)[5] <- "種類"
con <- dbConnect(PostgreSQL(), host="localhost", user= "postgres", password="XXXXX", dbname="test")
dbSendQuery(con, "SET CLIENT_ENCODING = 'SJIS'")
dbWriteTable(con, name="iris", value=iris)
[1] TRUE

I got an error.

library(dplyr)
mydb <- src_postgres(host="localhost",port="5432",user="postgres",password="XXXXX",dbname="test")
smp <- tbl(mydb, "iris")
Error in gsub(quote, paste0(quote, quote), x, fixed = TRUE) :
input string 1 is invalid in this locale

My sessionInfo is as follows.

sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=Japanese_Japan.932 LC_CTYPE=Japanese_Japan.932
[3] LC_MONETARY=Japanese_Japan.932 LC_NUMERIC=C
[5] LC_TIME=Japanese_Japan.932
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.1.3 RPostgreSQL_0.4 DBI_0.2-7 timeline_0.9
[5] ggplot2_0.9.3.1 reshape2_1.2.2 scrapeR_0.1.6 RCurl_1.95-4.1
[9] bitops_1.0-6 XML_3.98-1.1 googleVis_0.5.0-3

@hadley
Copy link
Member

hadley commented Mar 20, 2014

Why are you using SJIS ?

@dichika
Copy link
Author

dichika commented Mar 23, 2014

This is a toy example, and the character code of my working file is SJIS.

@hadley
Copy link
Member

hadley commented Mar 23, 2014

The file might be, but it's unlikely that r is encoding in sjis. What does Encoding(colnames(iris)) return?

@hadley hadley closed this as completed Apr 15, 2014
@hadley
Copy link
Member

hadley commented Apr 15, 2014

Please feel free to re-open if you can provide more details including a reproducible example.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants