- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:reference:connection:setcharset

# setCharSet

Support for this command is limited to MySQL and Postgres databases, as of ADOdb V6, you can use the setConnectionParameter() parameter with any database that supports character set configuration.

##### Syntax

     bool function setCharSet(
          string $characterSetName
          )

## Description

The function `setCharSet()` set the client side character set to the specified set. The function returns true or false based on the success of command execution.

## Usage

    $db->setCharset('utf8');

## Workaround for setting server side character set on MySQL

    $SQL =
     "SET character_set_results = 'utf8',
     character_set_client = 'utf8',
    character_set_connection = 'utf8',
     character_set_database = 'utf8',
    character_set_server = 'utf8'");
    $db->execute($SQL);

v5/reference/connection/setcharset.txt · Last modified: 2016/01/16 16:38 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top