Limitation on Unicode Character Encodings for Reading | Teradata R Package - 16.20 - Limitation on Unicode Character Encodings for Reading - Teradata R Package

Teradata® R Package User Guide

Product
Teradata R Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2022-05-02
dita:mapPath
qbt1519078127352.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
This limitation is only applicable when connecting to Vantage with Teradata ODBC Driver.

ODBC CharacterSet encodings UTF8 and UTF16 are not supported when reading data from a table containing Unicode characters.

To work around this limitation, use encoding = 'latin1' and CharcterSet = "ASCII" in the td_create_context function.

For example:
con <- td_create_context(dsn = "TeradataDSN", encoding = "latin1", CharcterSet = "ASCII")

dplyr::tbl(con, "TABLE_WITH_UNICODE_CHARS")

There is no limitation on writing data from an R data frame containing Unicode characters.

Create the connection with appropriate CharacterSet encodings.

For example:
con <- td_create_context("TeradataDSN1", CharacterSet = "UTF8")

# Sample R data frame containing unicode characters
mydf <- data.frame(id = c(101:103), str_utf = c("Rædwald", "Æthelhere", "Ecgric"), str_ascii = c("Abc", "XY", "DE1"))

dplyr::copy_to(con, df = mydf, name = "mydf_table")