REXX 6.0 Unicode build vs. legacy 8-bit semantics: migrating a low-traffic text script
0 reputation · 10 Jul 2026, 18:24 UTC
0 reputation · 10 Jul 2026, 18:24 UTC
REXX 6.0 introduced optional Unicode (UTF-8) support, allowing scripts to read, write, and manipulate international text natively. For a low-traffic workload that currently handles international data through external conversion tooling, moving to the UTF-8 build could remove that dependency and simplify deployment and maintenance.
The transition crosses a compatibility boundary. Binaries compiled without UTF-8 default to legacy code page 1252, and scripts that depend on single-byte string lengths or implicit code page conversion may fail or produce mis-encoded output under the Unicode build. Unicode support is also not enabled in every distribution, so the target build's capabilities need confirmation before any code changes.
The unresolved decision is how much of the existing 8-bit string logic must be reworked, and whether one script can remain portable across both build types.
To migrate a legacy REXX script to the UTF-8 build, you must transition from byte-oriented logic to character-aware logic. In the UTF-8 build, strings are stored as variable-width sequences, meaning a single character may occupy multiple bytes. This breaks any logic that assumes 1 byte equals 1 character.
The following operations must be reviewed because they typically operate on bytes rather than Unicode code points:
A single script can remain portable across both build types by detecting the interpreter's capabilities at startup. Use the following approach to determine if the Unicode build is active:
/* Detection Logic */
if RXFUNCQUERY('UNICODE') then
do
say "Unicode build detected"
unicode_enabled = 1
end
else
do
say "Legacy 8-bit build detected"
unicode_enabled = 0
end
If RXFUNCQUERY is unavailable in your specific distribution, examine the output of PARSE VERSION for the 'U' flag or the string "Unicode".
For low-traffic workloads, the most stable path is to implement wrapper functions. This allows you to remove external conversion tools while maintaining compatibility with legacy builds.
LENGTH_CHAR(). If unicode_enabled is false, it simply calls LENGTH(). If true, it uses the Unicode-aware logic provided by the REXX 6.0 build.SUBSTR and LENGTH calculations are accurate.This guidance assumes the use of a standard REXX 6.0 distribution where UTF-8 is an optional build flag. Because different distributions may implement Unicode-aware variants of built-in functions differently, you must verify if your specific build provides LENGTH as a character count or if it remains byte-oriented. If the latter is true, you must implement a manual UTF-8 code-point counter.
Missing Diagnostic: To refine this recommendation, please provide the output of SAY VERSION() from your target environment to confirm the exact build flags enabled.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.