Skip to content

Add optional iconv-extra layer for legacy character encodings - #671

Merged
mnapoli merged 1 commit into
brefphp:masterfrom
kolos:add-iconv-extra
Aug 4, 2026
Merged

Add optional iconv-extra layer for legacy character encodings#671
mnapoli merged 1 commit into
brefphp:masterfrom
kolos:add-iconv-extra

Conversation

@kolos

@kolos kolos commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an optional iconv-extra Lambda layer containing the glibc conversion modules that are present in the Bref build image but omitted from the slim runtime image.

Applications can attach the layer when they need legacy character encodings such as Windows-1250, without increasing the size of every Bref runtime.

Fixes: brefphp/bref#2145

Usage

provider:
    environment:
        GCONV_PATH: /opt/lib/gconv

functions:
    web:
        layers:
            - ${bref-extra:iconv-extra-php-83}

GCONV_PATH must be set before PHP starts so glibc can discover the modules under /opt/lib/gconv.

Reproduction

Without the layer, this conversion fails in the Bref PHP 8.3 runtime:

iconv('WINDOWS-1250', 'UTF-8', hex2bin('f5fbc1c9'));

With the layer and GCONV_PATH=/opt/lib/gconv, it returns őűÁÉ.

The issue also reproduces through Microsoft ODBC/PDO_SQLSRV when fetching a SQL Server varchar column using a Windows-1250 collation. The query fails with Unicode conversion failed without the layer and succeeds with it.

Size impact

Measured for PHP 8.3/x86-64:

  • Uncompressed: 8,332,066 bytes (about 7.95 MiB)
  • Compressed ZIP: 3,803,538 bytes (about 3.63 MiB)

Keeping this optional avoids adding that size to applications that only use UTF-8/Unicode encodings.

Validation

layer=iconv-extra php_versions=83 make test
layer=iconv-extra php_versions=83 make layers

@mnapoli
mnapoli merged commit 37da093 into brefphp:master Aug 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iconv lacks Windows-1250 / ISO-8859-2 support

2 participants