Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to insert and fetch "Arabic" (or Unicode) data from MySQL
,
this is my code to insert.

SQL
CREATE TABLE `hindi` (
    `data` varchar(200) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

    INSERT INTO `hindi` (`data`) VALUES
    (بريا)


but when i select it shows question marks(???????)
,how will i get the text in that language ??
am i missing anything ??
Posted
Updated 26-May-20 16:30pm
v3

HI,
Try this query.This works

SQL
-- You can use Nvarchar
CREATE TABLE hindi (
    data NVARCHAR(100) NOT NULL
)


-- before your insert values use"N" as below 
    INSERT INTO hindi (data) VALUES
    (N'بريا')

    select * from hindi
 
Share this answer
 
Comments
Madhuri Gamane 28-Nov-14 2:12am    
MySql Dont Has NVARCHAR datatype
syed shanu 28-Nov-14 2:28am    
HI,
Sorry for that in tag i saw SQl .I dont have Mysql .I check for the solution the below link seems it will work for you try this.


CREATE DATABASE hindi_test
CHARACTER SET utf8
COLLATE utf8_unicode_ci;

USE hindi_test;

CREATE TABLE `hindi` (
`data` varchar(200) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO `hindi` (`data`) VALUES
('कंप्यूटर');

Link :
http://stackoverflow.com/questions/11292898/how-to-insert-hindi-language-in-mysql

http://srinix.wordpress.com/2007/08/29/tutorial-how-to-store-utf8-indian-language-data-in-mysql/
Madhuri Gamane 28-Nov-14 5:24am    
Thanx but not working
mysqli_set_charset($this->connect,'utf8');
mysqli_query($this->connect, "SET NAMES 'utf8'");
mysqli_query($this->connect, 'SET CHARACTER SET utf8');
plus, yor table must be (utf8_general_ci) in structure field
this is work correctly for me
 
Share this answer
 
Comments
Member 14659276 12-Apr-21 7:40am    
Yes I tried it, correctly for me too
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900