AnsweredAssumed Answered

Accented characters or Special Characters ( spanish) issue with Textarea fields

Question asked by ananth ananth on Apr 16, 2015
Latest reply on Apr 9, 2017 by Predrag Vucetic
I'm trying to create a case in SugarCRM Pro 6.5.8  using Rest API (  PHP & Java). For reference, I have added my full PHP code at the end of this post.  I have two problems. 


Problem 1 : 


 I'm not able to create add case  if i use special character ( é ). But if i use HTML entity (  é   ) of that special character ( é ) , then its working, I'm able to create case.

Example : 

1) CODE 1 : which is not working : 

array("name" => "name", "value" => "case subject é"),

2) CODE 2 : which is working : 

array("name" => "name", "value" => "case subject Test é  "),

But if you use this (CODE 2) , then i'm get facing the issue explained in Problem 2. 


Problem 2 : 

If I use HTML entity  (  é   )   of special character (CODE 2)  to a field (name or subject field) whose type is "TextField" , then in the  Detailed View , its showing the correct data or special character ( é ) .

 But if  I use HTML entity  (  é   )  of special character (CODE 2)  to a field (description field ) whose type is  "Textarea" , then in the detailed view, its showing the junk character(    ) in SugarCRM Professional Edition.  

Create Case Page : 



Detailed Page with Junk Character: 




Full CODE: 

<?php
$url = "http://localhost/projects/sugar/sugars/service/v4_1/rest.php";
$username = "username";
$password = "password";
  function call($method, $parameters, $url)
  {
      ob_start();
      $curl_request = curl_init();
      curl_setopt($curl_request, CURLOPT_URL, $url);
      curl_setopt($curl_request, CURLOPT_POST, 1);
      curl_setopt($curl_request, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
      curl_setopt($curl_request, CURLOPT_HEADER, 1);
      curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, 0);
      curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($curl_request, CURLOPT_FOLLOWLOCATION, 0);
      $jsonEncodedData = json_encode($parameters);
      $post = array(
           "method" => $method,
           "input_type" => "JSON",
           "response_type" => "JSON",
           "rest_data" => $jsonEncodedData
      );
      curl_setopt($curl_request, CURLOPT_POSTFIELDS, $post);
      $result = curl_exec($curl_request);
      curl_close($curl_request);
      $result = explode("\r\n\r\n", $result, 2);
      $response = json_decode($result[1]);
      ob_end_flush();
      return $response;
  }
  //login --------------------------------------------- 
  $login_parameters = array(
       "user_auth" => array(
            "user_name" => $username,
            "password" => md5($password),
            "version" => "1"
       ),
       "application_name" => "RestTest",
       "name_value_list" => array(),
  );
  $login_result = call("login", $login_parameters, $url);
  //get session id
  $session_id = $login_result->id;
  /*
  //create case ------------------------------------- 
   
  $set_entry_parameters = array(
  //session id
  "session" => $session_id,
  
  //The name of the module from which to retrieve records.
  "module_name" => "Cases",
  
  //Record attributes
  "name_value_list" => array(
  array("name" => "name", "value" => " case subject   &eacute;  " ),
  array("name" => "description", "value" =>  "case description  &eacute;  " ),
  array("name" => "account_id", "value" => "40972bcf-612b-bc83-f695-5502be11215d"),
  ),
  );
try

$set_entry_result = call("set_entry", $set_entry_parameters, $url);
print_r($set_entry_result);
}
catch(Exception $e)
{
echo "error"; 
}  
?>

We are using SugarCRM Professional edition, Please check this. Any help would be greatly appreciated. 

Outcomes