KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Change in Default Encoding for TEXT TO DOCUMENT
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: February 10, 2025

Starting from 4D v19 R2, the default behavior of the TEXT VERS DOCUMENT($file; $txt) method has changed; the encoding is now UTF-8 without BOM, unlike previous versions where the default encoding was UTF-8 with BOM.

To generate your documents in UTF-8 with BOM, you need to add a third parameter to the TEXT VERS DOCUMENT method. This parameter allows you to specify the desired encoding, either with BOM or without BOM.

Example:


TEXT VERS DOCUMENT($file; $txt; "UTF-8") // Encoding with bom

TEXT VERS DOCUMENT($file; $txt; "UTF-16-no-bom") // Encoding withot bom