Yii Framework Forum: Arabic Text Display Issue - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Arabic Text Display Issue Related to the display of the issue of arabic text display

#1 User is offline   drmaxmad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 12-May 13

Posted 16 May 2013 - 07:24 AM

Hi All,


I am new to Yii application development, i ran into the issue of the arabic text display issue. I am getting all the text from database and i have tried to display it using the following code,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/DTD/xhtml1-transitional.dtd">
<html xmlns="removed the link because its my first post:P" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />
	<!-- Set the viewport width to device width for mobile -->
  	
	
</head>
<body>
<?php

	$conn = mysqli_connect("localhost","username","password","some database") or die ("connection error : " . mysqli_error());
	
	$result = mysqli_query($conn,"SELECT * FROM my_table WHERE field = 'value'");

	while($row = mysqli_fetch_array($result))
  	{
  		echo $row['title'] . " ::  " . $row['description'];
  		echo "<br>";
  	}

	mysqli_close($conn);
?>
</body>
</html>



Now the above code display arabic as it should be doing, when i try the same approach using Yii application, it shows some weird characters. I have added the character set information in /layout/main.php but no use.

I would love to hear a solution ,
Thanks
0

#2 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 16 May 2013 - 07:56 AM

Please show the code you tried in Yii
0

#3 User is offline   drmaxmad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 12-May 13

Posted 16 May 2013 - 08:41 AM

View Postbennouna, on 16 May 2013 - 07:56 AM, said:

Please show the code you tried in Yii


Well the whole view is quite big file, i can't paste all the code here but let me give you a brief work flow.

1. Made a controller that fetches information using MyModel::model()->find();
2. In this->render() method i am sending the information using the variable called $data.
3. I am using echo to print the information which i get from the controller like
echo $data->title . " : : " . $data->description;

Now the default website is in english, but i want to show the following text in arabic, as it is by default in arabic. So tell me what can i do approach this.
0

#4 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 16 May 2013 - 10:15 AM

Are you saying that when $data->title contains Arabic text, it doesn't display correctly in your url?

Or are you speaking about labels, texts, and dialogs of the views?

What is your db and what is your connection config?
0

#5 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 16 May 2013 - 10:17 AM

Well paste at least your main layout headers… or better, put a test app somewhere where I could debug.
0

#6 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 16 May 2013 - 10:23 AM

Ah yes, see also this wiki: http://www.yiiframew...-set-up-unicode (mdomba has just brought it up in another thread)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users