Problem while reading UCS-2 LE BOM encoded file in Apache NiFi

Viewed 1725

In Apache NiFi I'm trying to read a text file having encoding as UCS-2 LE BOM and then I'm trying to convert it to JSON. But Apache NiFi is considering it as a single line.

I tried converting to UTF-8 using ConvertText processor but it does not support encoding UCS-2 LE BOM.

Does anyone know how to convert this file to UTF-8 using Apache NiFi?

2 Answers

UCS-2 LE BOM is a predecessor of UTF-16 so try UTF-16 in ConvertText processor.

The simplest answer is probably to use an ExecuteScript processor and rely on Groovy's String encoding.

Unfortunately, the ConvertCharacterSet processor is only aware of the character encodings supported by your JDK, although you may have success with x-UTF-16LE-BOM (see Java 8 Character Sets).

Related