pg_client_encoding

PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8
pg_client_encoding - Gets the client encoding
Manual
Code Examples

pg_client_encoding( [PgSql\Connection|null$connection = null] ): string

PostgreSQL supports automatic character set conversion between server and client for certain character sets. pg_client_encoding returns the client encoding as a string. The returned string will be one of the standard PostgreSQL encoding identifiers.

Note:

This function requires PHP 4.0.3 or higher and PostgreSQL 7.0 or higher. If libpq is compiled without multibyte encoding support, pg_client_encoding always returns SQL_ASCII. Supported encoding depends on PostgreSQL version. Refer to the PostgreSQL Documentation supported encodings.

The function used to be called pg_clientencoding.

Parameters

connection

An PgSql\Connection instance. When connection is null, the default connection is used. The default connection is the last connection made by pg_connect or pg_pconnect.

Return Values

The client encoding.

Changelog

Version Description
8.1.0 The connection parameter expects an PgSql\Connection instance now; previously, a resource was expected.
8.0.0 connection is now nullable.

Related Functions

Example of pg_client_encoding

Show all examples for pg_client_encoding

PHP Version:


Function pg_client_encoding:

PostgreSQL Functions

Most used PHP functions