KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Bad characters in cloudexport pdf #3326

Open Francois DISSAIT opened this topic on on Aug 16 - 1 comments

Francois DISSAIT commented on Aug 16

Hello, I have a report from a Database utf8 coded, french characters with accents. when export to pdf with cloud export, characters are non treated well : Forum Réfugiés becomes : Forum Réfugiés.

Here is my pdfview file :

<?php
    use \koolreport\widgets\google;   
	use \koolreport\widgets\koolphp\Table;
	$avertissement  = "";
	
	?>
<html>
    <head>
        <meta charset="UTF-8">
    </head>
	
<?php

// pour trouver la référence de la promesse et la mettre dans $reference
try
{
	// On se connecte à MySQL
	$mysqlClient = new PDO('mysql:host=185.224.138.141;dbname=u521225422_phamm;charset=utf8','u521225422_admin','NewTech63');
}
catch(Exception $e)
{
	// En cas d'erreur, on affiche un message et on arrête tout
        die('Erreur : '.$e->getMessage());
}
// Si tout va bien, on peut continuer
// On récupère tout le contenu de la table 
$sqlQuery = "
SELECT 
  expeditions.reference,
  expeditions.date_expedition,
  expeditions.valeur_expedition,
  expeditions.valeur_fret,
  expeditions.valeur_FOB,
  expeditions.organisme_destination AS dest_org,
  expeditions.adresse_destination AS dest_adrss,
  expeditions.ville_destination AS dest_ville,
  expeditions.pays AS dest_pays,
  expeditions.moyen as dest_moyen,
  expeditions.container_numero as dest_numero, 
  clients.Client AS av_client,
  clients.Adresse AS av_adresse,
  CONCAT(clients.Code_postal, ' ', clients.Ville) AS av_ville,
  clients.country AS av_pays,
  clients.email AS av_mail,
  clients.phone AS av_telephone
FROM
  expeditions
  INNER JOIN clients ON (expeditions.destinataire = clients.id)
WHERE
  expeditions.termine = 'NON'
  ";
	
$recipesStatement = $mysqlClient->prepare($sqlQuery);
$recipesStatement->execute();
$recipes = $recipesStatement->fetchAll();
// On affiche chaque reference une à une
foreach ($recipes as $recipe) {
?>
    <p>
	<?php 
	$ref = $recipe['reference'];$ref= $ref.". "; 
	//$ref = iconv(mb_detect_encoding($ref, mb_detect_order(), true), "UTF-8", $ref);//on a récupéré la référence de la promesse unique dans $ref
	$av_client = $recipe['av_client'];		 
	$av_adresse = $recipe['av_adresse'];
	$av_ville = $recipe['av_ville'];
	$av_pays = $recipe['av_pays'];
	$av_mail = $recipe['av_mail'];
	$av_telephone = $recipe['av_telephone'];
	$date_expedition = $recipe['date_expedition'];
	$date=date_create($date_expedition);
	$valeur_expedition = $recipe['valeur_expedition'];
	$valeur_fret = $recipe['valeur_fret'];
	$valeur_FOB = $recipe['valeur_FOB'];
	$dest_org = $recipe['dest_org'];		 
	$dest_adrss = $recipe['dest_adrss'];
	$dest_ville = $recipe['dest_ville'];
	$dest_pays = $recipe['dest_pays'];
	$dest_moyen = $recipe['dest_moyen'];
	$dest_numero= $recipe['dest_numero'];	
	?>
	</p>
<?php
}

?>

<html>
<style>
    .title {
        text-align: center;
        border: 3px solid green;
    }
</style>
	<?php
        echo '<img src="entete.png" border="0" />' . "\n";
    ?>

	<div class="row">
		<div class="col-sm-6">
			<!-- company info -->			
			<h4>4, Voie Militaire des Gravanches<br>63100 CLERMONT FERRAND <br>France<br>
			<h4>N. Siret : 53194972500018<br>
			<h4>Date : 
			<?php  echo date_format($date,"d/m/Y ") . "\n";   ?><br>
			</h4>
			<h4>en partenariat avec : 
			<br>
			<?php  echo $av_client . "\n";    ?>
			<br>
			<?php  echo $av_adresse . "\n";    ?>
			<br>
			<?php  echo $av_ville . "\n";    ?>
			<br>
			<?php  echo $av_pays . "\n";    ?>
			<br>T&eacute;l&eacute;phone : 
			<?php  echo $av_telephone . "\n";    ?>
			<br>Mail : 
			<?php  echo $av_mail . "\n";    ?>
			<br><br>
			</h4>
		</div>
	</div>	
	<body style="margin-top:2cm;margin-right:1cm;margin-bottom:2cm;margin-left:1cm;width:95%">
    <link rel="stylesheet" href="../../../assets/bs3/bootstrap.min.css" />
    <link rel="stylesheet" href="../../../assets/bs3/bootstrap-theme.min.css" />
    <div class="title">
        <h1>CERTIFICAT DE DON - FACTURE PROFORMA</h1>      
		</h1>
	</div>
	<br> 
	<?php
	$sqlQuery = "
SELECT 
  COUNT(batches.code_colis) as nb_colis,
  SUM(batches.nombre_paquets) as nb_paquets,
  SUM(batches.poids_colis) as poids_total
  
FROM
  expeditions
  INNER JOIN colis_expeditions ON (expeditions.id = colis_expeditions.reference_expedition)
  INNER JOIN batches ON (colis_expeditions.code_colis = batches.id)
WHERE  expeditions.termine='NON'";
$recipesStatement = $mysqlClient->prepare($sqlQuery);
$recipesStatement->execute();
$recipes = $recipesStatement->fetchAll();
// On affiche chaque reference une à une
foreach ($recipes as $recipe) {
?>
    <p>
	<?php 
	$nb_colis = $recipe['nb_colis'];
	$nb_paquets = $recipe['nb_paquets'];		 
	$poids_total = $recipe['poids_total'];
	?>
	</p>
<?php
}
	?>
	<i>
		<h4> <?php echo "Je soussign&eacute;, PHARMACIENS HUMANITAIRES AUVERGNE certifie par la pr&eacute;sente que " ; ?></h4>
		 
		<h4> <?php echo "les marchandises mentionn&eacute;es sont destin&eacute;es &agrave; un projet sanitaire et humanitaire de " ; ?></h4>
	 		
		</i>
		<h3 class="text-center">ASSOCIATION PARTENAIRE : </h3>
		<i>
		<h4> <?php echo $av_client.", ".$av_adresse.", ".$av_ville.", ".$av_pays."." ; ?></h4>
		</i>
		<h3 class="text-center">DESTINATION : </h3>
		<i>
		<h4> <?php echo $dest_org.", ".$dest_adrss.", ".$dest_ville.", ".$dest_pays."." ; ?></h4>
		</i>
		<h3 class="text-center">TYPE DE MARCHANDISES. </h3>
		<i>
		<h4><?php echo $nb_colis;?> colis contenant <?php echo $nb_paquets;?> paquets. </h4>
		<h4>Poids total <?php echo $poids_total;?> kg. </h4>
        <h4> <?php echo "Mat&eacute;riel, mobilier et consommables m&eacute;dicaux. Mobilier de bureau." ; ?></h4>	
		</i>	
<style>
    @media  print {
      #proforma_promesse .break-row td {
        padding: 0 !important;
      }
      * {
        -webkit-print-color-adjust: exact !important;
      }
     
    }
</style>
<html>
	<head>
		<title></title>
	</head>
	<body style='margin: 0.2in'>
     <link rel="stylesheet" href="../../../assets/bs3/bootstrap.min.css" />
     <link rel="stylesheet" href="../../../assets/bs3/bootstrap-theme.min.css" />    
    
		
		<table id='tempTable' style='display:none'>
			<tr class='break-row'>
				<td colspan='999'>
				    <div></div>
					<div class='break-before'></div>
				</td>
			</tr>
		</table>
         	
			<br>   
			<h3 class="text-center">AIDE HUMANITAIRE - NE PEUT ETRE VENDU. </h3>
			<br> 
			<h4 class="text-center">Valeur indicative des marchandises : 
			<?php echo $valeur_expedition;?> euros. </h4>
			<h4 class="text-center">Valeur du fret : 
			<?php echo $valeur_fret;?> euros. </h4>
			<h4 class="text-center">Montant des frais FOB : 
			<?php echo $valeur_FOB;?> euros. </h4>
			<h3 class="text-center">VALEUR INDICATIVE POUR LES DOUANES. </h3>
			<h3 class="text-center">AUCUNE VALEUR COMMERCIALE. </h3>
            <br>
			<?php
				echo "<div style='font-weight: bold'>";
			?>	
			LORS DE LA REMISE DU MATERIEL AU BENEFICIAIRE, SON ORIGINE DOIT ETRE PRECISEE PAR LA MENTION:</h4>
			<br>					
			DON DE PHARMACIENS HUMANITAIRES AUVERGNE - 63000 CLERMONT FERRAND - FRANCE . </h4>
			<br> 
			<?php
				echo "<div style='text-align:right'>";
			?>
			<h5>Le repr&eacute;sentant de P.H.A.M.M.</h5> 
			<?php
			echo '<img src="tampon.png" border="0" />' . "\n";		
			?>  
  </body>
</html>


What is wrong ? Francois

Francois DISSAIT commented on Aug 16

Solved Must add

<html>
    <head>
        <meta charset="UTF-8">
    </head>

at the top of the xxxxPDF.view.php file

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

CloudExport