KNOWLEDGE BASE

Error "Tableau Data Engine Error: 4 error measuring utf8 to utf16" Connecting to Extract


Published: 11 Mar 2014
Last Modified Date: 03 May 2016

Issue

When connecting to a Tableau Data Extract (TDE) created with the Tableau Data Extract API, and using string calculations such as CONTAINS, ASCII and FIND, the following error might occur:

Tableau Data Engine Error: 4 error measuring utf8 to utf16

Environment

  • Tableau Desktop
  • Tableau Data Extract API
  • Tableau Data Engine (TDE)

Resolution

Use one of the following to encode the string in UTF-8 format:

In Python

newrow.setCharString(32, r[64].encode('utf_8', 'strict'))

In Java

String utf8Value = new String(value.getBytes(Charset.defaultCharset()), "UTF-8");

Cause

The Row.setCharString method requires the string to be converted to UTF-8 prior to calling this method.
Did this article resolve the issue?