Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to convert mysql tables to utf-8 ?

 
alsoumahi alBatal
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys , I need to use arabic languages as values of my table , I have searched and find out that I need to convert tables to utf-8 , how is done that???, I am using mysql , and I am inserting data inside the database using mysql command prompt . so how to convert tables using commands because I don't have phpAdmin. For the web server side, I am using tomcat.

thanks a lot
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
 
alsoumahi alBatal
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:See this.

thanks a lot , but now I have a problem which is I can't write arabic text as values of table , here is the steps I have done , please help me and correct me if I am mistaken

this is what I did:
**************************************************
set names utf8 COLLATE utf8_general_ci;

create database see;

use see;

ALTER DATABASE see CHARACTER SET utf8 COLLATE utf8_general_ci;

create table one (name varchar(20) ) default charset utf8;
ALTER TABLE one CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE one MODIFY name TEXT CHARACTER SET utf8 COLLATE utf8_general_ci;

insert into one(name)
values("علي");
**********************************************************************************

everything works fine , this is what appear to me when I press status:
**********************************************************************************
Connection id: 12
Current database: see
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.1.49-community MySQL Community Server (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: latin1
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 9 hours 40 min 53 sec

Threads: 1 Questions: 106 Slow queries: 0 Opens: 32 Flush tables: 1 Open ta
bles: 1 Queries per second avg: 0.3
**********************************************************************************

so when I do insert command and write the arabic text , it appears unaderstandable word and is saved like that , why!!! , is it because mysql prompt doesn't support arabic language , or I miss something .

this is what appear to me , at the end , after inserting the values:

ERROR 1366 (HY000): Incorrect string value: '\xE3\xE9\xEF' for column 'name' at
row 1

please tell me how I could write arabic text into database from command prompt , where is my mistake???

thanks in advance
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic