bind_textdomain_codeset - Linux


bind_textdomain_codeset sets the character encoding for translation calls. This is necessary if the default encoding (UTF-8) does not match the encoding your application expects.


bind_textdomain_codeset(domain, codeset)


| Option | Description | Default Value |
| domain | The name of the domain to set the character encoding for. | None |
| codeset | The desired character encoding for the domain. | UTF-8 |


To set the character encoding for the my_domain domain to Windows-1252:

bind_textdomain_codeset("my_domain", "Windows-1252");

Common Issues

  • If the specified codeset is not supported by your system, an error will be raised.


bind_textdomain_codeset() can be used in conjunction with gettext() and dgettext() to translate strings to the desired character encoding.

Related Commands

  • gettext
  • dgettext
  • setlocale