To be notice MS SQL supports only UCS-2 encoding so do not have encoding with UTF-8 as we expected as MySQL or some other database server as well. This means that you can't use UTF-8 character encoding with Microsoft SQL Server:
Here after I type Khmer Unicode and execute the query, I got question marks instead of characters:
So if you need to store national characters in Microsoft SQL Server - please consider using a national character encoding (
U+1780 to U+17FF in Unicode/ISO10646 for Khmer Unicode characters, for example). Change data types:
- varchar to nvarchar
- text to ntext
- char to nchar
Here is the example since I created a table and insert data:
1. Create database (mtr_db) as normally (default setting)
2. Create table (tblunicode) with two fields (id/name) but
name - data type
nvarchar(MAX)
3. Insert Khmer Unicode and execute we got it as we typed!
Good luck!
hi, i can insert into database but the character still show the question mark(??????), and could you please to tell what is my mistake.
ReplyDeletethank
how to search string in khmer unicode from Ms SQl
ReplyDeletethis solution can not help me! i still got ???????????? in my table
ReplyDeletestill now work!
ReplyDeleteTRY THIS:
ReplyDeleteEXAMPLE: INSERT INTO tUSER(UserName) VALUES(N'កម្ពុជា')
HOPE THIS HELPFUL
This comment has been removed by the author.
DeleteThis comment has been removed by the author.
DeleteThis comment has been removed by the author.
DeleteI connect to mysql by php like this, and it work perfect for me:
ReplyDelete$host = "localhost";
$user = "root";//Your mysql user
$pass = "";//Your mysql password
$db = "book_songs";////Your mysql database name
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_query("SET character_set_results=utf8",$connection);
mb_language('uni');
mb_internal_encoding('UTF-8');
mysql_select_db($db, $connection) or die ("Unable to select database!");
mysql_query("set names 'utf8'",$connection);
Hope this can help you
https://www.youtube.com/watch?v=5D_ElHGZ-i8
ReplyDeletei hop this video can help u