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
convertfunction 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
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
convertto 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
convert('UTF-8', 'iso-8859-1', body)re-encodes the UTF-8 stringSkellefteåas ISO-8859-1 bytesbase64encode(..., '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: 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
convert('UTF-8', 'windows-1252', body)re-encodesCaféfrom UTF-8 to Windows-1252 bytesbase64encode(..., 'windows-1252')converts those bytes to base64
This is useful when integrating with legacy Windows systems that expect Windows-1252 encoding.
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: Convert context value to ISO-8859-1 for legacy system
Features
Important
The
convertFormula 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
base64encodeto 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:
- Open your Nodinite Web Client
- Navigate to Administration → Search Fields
- Create or edit a Search Field
- Choose Formula as the expression type
- Enter your conversion expression using the Syntax patterns above
Next step
- Learn how to create a Search Field with an Expression