How can I display Arabic characters in web page using php and sql server? The Arabic data is stored in the database (sql server). Now I want to use php to display that data on the web page. How can I do this?
2
-
HTML can display characters from any language. For example, this comment is displaying some arabic characters : ﲅﱗﮅٿجرﴊﻇﴆﶆﻸﴢ.Liao– Liao2009-07-31 07:31:51 +00:00Commented Jul 31, 2009 at 7:31
-
@Liao: "some" being the highlight there :PShadi Almosri– Shadi Almosri2010-01-01 20:30:10 +00:00Commented Jan 1, 2010 at 20:30
Add a comment
|
3 Answers
The official solution for Unicode in mssql with php
$serverName = "MyServer";
$connectionInfo = array( "Database"=>"AdventureWorks", "CharacterSet" => "UTF-8");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
use this in your connection code,
get more support on utf 8 issue on
http://msdn.microsoft.com/en-us/library/cc626307.aspx
Comments
Some SO archive may help you some ideas -
Storing and displaying unicode string (हिन्दी) using PHP and MySQL
Arabic text displaying in webapp without db changes
what is the best method to build "multilingual" script in php?
Comments
Note: its php/mysql based example:
- Before you can store Arabic content
in a database, you need to create a
table. The following example
demonstrates the
CREATEsyntax - You need to make sure your browser supports the character set.
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
SQL Statements:
//assumed : connection to the database is open
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES 'utf8'");
// select records
mysql_query("SELECT * FROM en_authors");