• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

how to convert mysql tables to utf-8 ?

 
Ranch Hand
Posts: 119
  • 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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
 
alsoumahi alBatal
Ranch Hand
Posts: 119
  • 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
 
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic