- 4 minutes to read

Formula - convert

Easily convert string encodings using the Nodinite convert Formula plugin. This page shows how to transform data between different character encodings from message Content, Context, or the output of other formulas.

🎯 Designed for business users and integrators — no developer required; you can even use AI to craft expressions.

  • ✅ Convert data between encodings from any Payload or Context in any Log Event
  • ✅ Transform between character encodings like UTF-8, ISO-8859-1, and more
  • ✅ Fix garbled characters and ensure data integrity in Nodinite Log Views, search filters, and self-service diagnostics
  • ✅ Combine with other Formula functions for powerful, layered expressions

What does the convert Formula do?

The convert('SourceEncoding', 'TargetEncoding', Content) Formula function re-encodes text from one character encoding to another at the byte level. This is essential when you need to prepare UTF-8 text for systems or operations that require specific encodings (like ISO-8859-1 or Windows-1252).

Important

The convert function works with byte streams, not already-decoded strings. Use it to prepare data in a specific encoding before operations like base64 encoding, file writing, or sending to legacy systems. It cannot "fix" strings that have already been incorrectly decoded.


How it works: Input ➜ convert ➜ Result

graph LR A["Input: UTF-8 text (e.g., 'Skellefteå')"] --> B["convert('UTF-8', 'ISO-8859-1', Content)"] B --> C["Result: Same text, re-encoded as ISO-8859-1 bytes"] C --> D["Use in base64encode, file operations, etc."]

Flow: The UTF-8 text is re-encoded to ISO-8859-1 bytes, ready for operations that require that specific encoding.


Syntax

Convert UTF-8 text to ISO-8859-1 before base64 encoding: (See Example 1)

base64encode(convert('UTF-8', 'iso-8859-1', body), 'iso-8859-1')

Convert UTF-8 text to Windows-1252 before base64 encoding: (See Example 2)

base64encode(convert('UTF-8', 'windows-1252', body), 'windows-1252')

Convert message context property to different encoding: (See Example 3)

base64encode(convert('UTF-8', 'iso-8859-1', context('PropertyName')), 'iso-8859-1')

With nested formulas:

base64encode(convert('UTF-8', 'iso-8859-1', jsonpath('$.path', body)), 'iso-8859-1')

Examples

Example 1: Convert UTF-8 to ISO-8859-1 before Base64 encoding

Tip

When you need to send UTF-8 text to a legacy system that expects ISO-8859-1 bytes, use convert to re-encode the text before base64 encoding. This ensures the receiving system gets the correct byte representation.

Input

Message body is Skellefteå (UTF-8 text)

Formula Expression

base64encode(convert('UTF-8', 'iso-8859-1', body), 'iso-8859-1')

Result

U2tlbGxlZnRl5Q== (Base64-encoded ISO-8859-1 bytes)

Explanation

  1. convert('UTF-8', 'iso-8859-1', body) re-encodes the UTF-8 string Skellefteå as ISO-8859-1 bytes
  2. base64encode(..., 'iso-8859-1') converts those ISO-8859-1 bytes to base64

Without calling convert first, base64encode(body, 'iso-8859-1') would fail because the function assumes the input is already ISO-8859-1 encoded, but receives UTF-8 bytes containing characters outside the ASCII range.

Example 1 Example 1: Convert UTF-8 to ISO-8859-1 before Base64 encoding


Example 2: Convert UTF-8 to Windows-1252 before Base64 encoding

Input

Message body is Café (UTF-8 text)

Formula Expression

base64encode(convert('UTF-8', 'windows-1252', body), 'windows-1252')

Result

Q2Fmqg== (Base64-encoded Windows-1252 bytes)

Explanation

  1. convert('UTF-8', 'windows-1252', body) re-encodes Café from UTF-8 to Windows-1252 bytes
  2. base64encode(..., 'windows-1252') converts those bytes to base64

This is useful when integrating with legacy Windows systems that expect Windows-1252 encoding.

Example 2 Example 2: Convert UTF-8 to Windows-1252 before Base64 encoding


Example 3: Convert context value to ISO-8859-1 for legacy system

Input

Message context contains a property CityName with value Malmö (UTF-8)

Formula Expression

base64encode(convert('UTF-8', 'iso-8859-1', context('CityName')), 'iso-8859-1')

Result

TWFsbfY= (Base64-encoded ISO-8859-1 bytes)

Explanation

The context property CityName contains UTF-8 text. Converting to ISO-8859-1 and base64 encoding prepares it for transmission to a system that expects ISO-8859-1 encoded data.

Example 3 Example 3: Convert context value to ISO-8859-1 for legacy system


Features

Important

The convert Formula re-encodes text from one character encoding to another at the byte level. Use it to prepare UTF-8 data for systems or operations that require specific encodings (ISO-8859-1, Windows-1252, etc.). This function works with byte streams and loads the entire message into RAM—use on small messages only.

  • Flexible Inputs: Convert text from message body, Context, or the result of another Formula
  • Encoding Support: Re-encode between UTF-8, ISO-8859-1, Windows-1252, and more (see List of encodings)
  • Legacy System Integration: Prepare UTF-8 data for systems that require specific legacy encodings
  • Base64 Compatibility: Use before base64encode to ensure correct byte representation
  • Composable: Combine with jsonpath, xpath, and other Formula functions
  • Self-Service: Let business users prepare data for legacy systems without developer intervention

How to use

To use the convert Formula in a Search Field Expression:

  1. Open your Nodinite Web Client
  2. Navigate to AdministrationSearch Fields
  3. Create or edit a Search Field
  4. Choose Formula as the expression type
  5. Enter your conversion expression using the Syntax patterns above

Next step