Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<_bindtextdomain>
^Gettext FunctionsLast updated: Mon, 26 Oct 2026

bind_textdomain_codeset

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

bind_textdomain_codeset — Specify or get the character encoding in which the messages from the DOMAIN message catalog will be returned

Description

function bind_textdomain_codeset(string $domain, ?string $codeset = null): string|false

bind_textdomain_codeset() allows to set or get the encoding in which messages from domain will be returned by gettext() and similar functions.

Parameters

domain

The domain.

codeset

The code set. If null, the currently set encoding is returned.

Return Values

A string on success.

Errors/Exceptions

Throws a ValueError if domain is the empty string.

Changelog

Version Description
8.4.0 Now throws a ValueError if domain is the empty string.
8.4.0 codeset is optional now. Previously, the parameter always had to be specified.
8.0.3 codeset is nullable now. Previously, it was not possible to retrieve the currently set encoding.

Notes

Note:

The bind_textdomain_codeset() information is maintained per process, not per thread.


<_bindtextdomain>
^Gettext FunctionsLast updated: Mon, 26 Oct 2026