{"action":"created","issue":{"url":"https://api.github.com/repos/r-dbi/odbc/issues/126","repository_url":"https://api.github.com/repos/r-dbi/odbc","labels_url":"https://api.github.com/repos/r-dbi/odbc/issues/126/labels{/name}","comments_url":"https://api.github.com/repos/r-dbi/odbc/issues/126/comments","events_url":"https://api.github.com/repos/r-dbi/odbc/issues/126/events","html_url":"https://github.com/r-dbi/odbc/issues/126","id":268392796,"node_id":"MDU6SXNzdWUyNjgzOTI3OTY=","number":126,"title":"nvarchar character encoding in nettezza db","user":{"login":"andreaspano","id":4634410,"node_id":"MDQ6VXNlcjQ2MzQ0MTA=","avatar_url":"https://avatars3.githubusercontent.com/u/4634410?v=4","gravatar_id":"","url":"https://api.github.com/users/andreaspano","html_url":"https://github.com/andreaspano","followers_url":"https://api.github.com/users/andreaspano/followers","following_url":"https://api.github.com/users/andreaspano/following{/other_user}","gists_url":"https://api.github.com/users/andreaspano/gists{/gist_id}","starred_url":"https://api.github.com/users/andreaspano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreaspano/subscriptions","organizations_url":"https://api.github.com/users/andreaspano/orgs","repos_url":"https://api.github.com/users/andreaspano/repos","events_url":"https://api.github.com/users/andreaspano/events{/privacy}","received_events_url":"https://api.github.com/users/andreaspano/received_events","type":"User","site_admin":false},"labels":[{"id":407723716,"node_id":"MDU6TGFiZWw0MDc3MjM3MTY=","url":"https://api.github.com/repos/r-dbi/odbc/labels/bug","name":"bug","color":"e02a2a","default":true},{"id":849309740,"node_id":"MDU6TGFiZWw4NDkzMDk3NDA=","url":"https://api.github.com/repos/r-dbi/odbc/labels/reprex","name":"reprex","color":"eb6420","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2017-10-25T13:14:18Z","updated_at":"2018-06-08T15:20:19Z","closed_at":null,"author_association":"NONE","body":"### Issue Description and Expected Result\r\nWhen quering nettezza on  nvarchar fields,  returns strange characters instead of plain UTF-8.\r\nThe issue occurs only on nvarchar.\r\nvarchar, date_time and numeric work correctly\r\n\r\n### Database\r\nIBM Netezza \r\n\r\n### Reproducible Example\r\n```r\r\nlibrary(odbc)\r\n  con <- dbConnect(odbc::odbc(),\r\n                   driver = \"NetezzaSQL\",\r\n                   database = \"NYCFLIGHTS\",\r\n                   uid = \"user\",\r\n                   pwd = \"user\",\r\n                   server = \"192.168.69.xxx\",\r\n                   port = 5480,\r\n                   encoding = 'UTF-8')\r\n\r\ndbGetQuery(con, 'select TAILNUM, SEATS from planes limit 3')\r\n\r\n  TAILNUM SEATS\r\n1  ㅎ㔱ㄵ    55\r\n2  ㅎㄲ㈴    55\r\n3  ㅎㄲ㌶    55\r\n\r\n```\r\n\r\n\r\n```r\r\ndevtools::session_info()\r\nsetting  value                       \r\n version  R version 3.4.1 (2017-06-30)\r\n system   x86_64, linux-gnu           \r\n ui       RStudio (1.1.383)           \r\n language en                          \r\n collate  it_IT.UTF-8                 \r\n tz       Europe/Rome                 \r\n date     2017-10-25    \r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/r-dbi/odbc/issues/comments/395794591","html_url":"https://github.com/r-dbi/odbc/issues/126#issuecomment-395794591","issue_url":"https://api.github.com/repos/r-dbi/odbc/issues/126","id":395794591,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTc5NDU5MQ==","user":{"login":"jimhester","id":205275,"node_id":"MDQ6VXNlcjIwNTI3NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/205275?v=4","gravatar_id":"","url":"https://api.github.com/users/jimhester","html_url":"https://github.com/jimhester","followers_url":"https://api.github.com/users/jimhester/followers","following_url":"https://api.github.com/users/jimhester/following{/other_user}","gists_url":"https://api.github.com/users/jimhester/gists{/gist_id}","starred_url":"https://api.github.com/users/jimhester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimhester/subscriptions","organizations_url":"https://api.github.com/users/jimhester/orgs","repos_url":"https://api.github.com/users/jimhester/repos","events_url":"https://api.github.com/users/jimhester/events{/privacy}","received_events_url":"https://api.github.com/users/jimhester/received_events","type":"User","site_admin":false},"created_at":"2018-06-08T15:20:19Z","updated_at":"2018-06-08T15:20:19Z","author_association":"MEMBER","body":"The ODBC Specification seems to be that all SQLWCHAR data should be [little endian](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/programming-guidelines?view=sql-server-2017)\r\n\r\n> SQLWCHAR data must be UTF-16LE (Little Endian).\r\n\r\nSo this seems like a driver issue to me, I am not sure if there is a driver configuration setting that can change this or not.\r\n\r\nYou should be able to convert the data after retrieval by using `iconv(x, \"UTF-16BE\", \"UTF-8\")` or similar."}}
{"actor":{"display_login":"jimhester"}}