The symbols are saving properly in database but while it is being displayed in the view the symbols are not displaying propely.
Data as saved in database:
<p>Symbol here is sigma : Σ</p>
<p>Symbol here is beta: β</p>
<p>Symbol here is omega: Ω</p>
<p>Symbol here is gamma: γ</p>
Data being displayed:
Symbol here is sigma : Σ
Symbol here is beta: β
Symbol here is omega: Ω
Symbol here is gamma: γ
Code for fetching data:
public function get_questions() {
$this->layout = false;
if(($this->request->is('post')) && ($this->request->is('ajax'))) {
$subject = $this->request->data['subject'];
$chapter = $this->request->data['chapter'];
$studentID = $this->Auth->User('PERSONROLE');
//$phase = $subject->getPhase($subject);
$this->Paginator->settings = array(
'limit' => 1,
'conditions' => array(
'QuestionBank.SUBJECT' => $subject,
'QuestionBank.CHAPTER' => $chapter,
'QuestionBank.IS_ACTIVE' => 1,
//'QuestionBank.PHASE'
),
);
$questions = $this->paginate();
if($questions) {
$questions[0]['QuestionBank']['page'] = $this->request->params['paging']['QuestionBank']['page'];
$questions[0]['QuestionBank']['current'] = $this->request->params['paging']['QuestionBank']['current'];
$questions[0]['QuestionBank']['count'] = $this->request->params['paging']['QuestionBank']['count'];
$questions[0]['QuestionBank']['prevPage'] = $this->request->params['paging']['QuestionBank']['prevPage'];
$questions[0]['QuestionBank']['nextPage'] = $this->request->params['paging']['QuestionBank']['nextPage'];
$questionID = $questions[0]['QuestionBank']['ID'];
$selfStudyStatus = $this->_getQuestionStatus($questionID, $studentID);
if($selfStudyStatus) {
$questions[0]['SelfStudyStatus'] = $selfStudyStatus['SelfStudy'];
}
$this->loadModel('MyNote');
$myNote = new MyNote();
$notes = $myNote->getPersonalNote($questionID, $studentID);
if($notes) {
$questions[0]['MyNote'] = $notes['MyNote'];
} else {
$questions[0]['MyNote'] = array();
}
$this->loadModel('Enquiry');
$enquiry = new Enquiry();
$enquiries = $enquiry->getEnquiries($studentID, $questionID);
if($enquiries) {
$questions[0]['Enquiry'] = $enquiries;
} else {
$questions[0]['Enquiry'] = array();
}
}
array_walk_recursive($questions, function(&$value, $key) {
if (is_string($value)) {
$value = iconv('windows-1252', 'utf-8', $value);
}
});
$this->set('questions', $questions[0]);
}
}
Please check the code above and is this line "$value = iconv('windows-1252', 'utf-8', $value);" got to do something with the conversion. The charset conversion is new for me.