CakePHP, MySQL

MySQL: Save Arabic Characters / Words

Database / Table for Arabic Usage

  1. Charset – UTF-8
  2. Collation – utf8_unicode_ci

Example:


# Database
CREATE DATABASE `db_arabic`CHARACTER SET utf8 COLLATE utf8_unicode_ci;

# Table
CREATE TABLE `db_arabic`.`users`( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(255), `created` DATETIME, `modified` DATETIME, PRIMARY KEY (`id`) ) CHARSET=utf8 COLLATE=utf8_unicode_ci; 

In CakePHP, make sure to set 'encoding' => 'utf8' in database.php.

You can have Arabic Lorem Ipsum at Multilanguage Lorem Ipsum Generator

For web page, please ensure to add meta tag, charset `utf-8′, as following:

<meta charset="utf-8" />

Reference: How to save Arabic Words Into MySQL Table

Leave a Reply

Your email address will not be published. Required fields are marked *

five × 5 =