diff --git a/htdocs/includes/fpdf/fpdf/fpdf.php b/htdocs/includes/fpdf/fpdf/fpdf.php
index e42d47a67d3..b0edb140c40 100644
--- a/htdocs/includes/fpdf/fpdf/fpdf.php
+++ b/htdocs/includes/fpdf/fpdf/fpdf.php
@@ -12,7 +12,6 @@
/*
* $Id$
-* $Source$
*/
/**
diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php
index 0e64b1ad964..e6524ad897a 100644
--- a/htdocs/includes/modules/facture/pdf_crabe.modules.php
+++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php
@@ -251,7 +251,7 @@ class pdf_crabe extends ModelePDFFactures
}
else
{
- $fac->lignes[$i]->desc='€zaaaa';
+ //$fac->lignes[$i]->desc='€zaaaa';
//print dol_string_is_good_iso($fac->lignes[$i]->desc);
//print dol_htmlentitiesbr($fac->lignes[$i]->desc);
//print exit;
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index e04d369a227..086d1111df8 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -2420,17 +2420,6 @@ function measuring_units_string($unit,$measuring_style='')
return $measuring_units[$unit];
}
-/**
- \brief Decode le code html
- \param string StringHtml
- \return string DecodeString
-*/
-function dol_entity_decode($StringHtml)
-{
- $DecodeString = html_entity_decode($StringHtml);
- return $DecodeString;
-}
-
/**
\brief Clean an url
\param url Url
@@ -2536,17 +2525,22 @@ function dol_nl2br($stringtoencode,$nl2brmode=0)
/**
* \brief This function is called to encode a string into a HTML string
* \param stringtoencode String to encode
-* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br
+* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br (for use with FPDF writeHTMLCell function for example)
* \remarks For PDF usage, you can show text by 2 ways:
* - writeHTMLCell -> param must be encoded into HTML.
* - MultiCell -> param must not be encoded into HTML.
* Because writeHTMLCell convert also \n into
, if function
-* is used to build PDF, nl2br must be 1.
+* is used to build PDF, nl2brmode must be 1.
*/
function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0)
{
if (dol_textishtml($stringtoencode)) return $stringtoencode;
- else return dol_nl2br(htmlentities($stringtoencode),$nl2brmode);
+ else {
+ $newstring=dol_nl2br(htmlentities($stringtoencode),$nl2brmode);
+ // Other substitutions that htmlentities does not do
+ $newstring=str_replace(chr(128),'€',$newstring); // 128 = 0x80
+ return $newstring;
+ }
}
/*
@@ -2563,6 +2557,37 @@ function dol_htmlentitiesbr_decode($stringtodecode)
return $ret;
}
+/**
+ \brief Decode le code html
+ \param string StringHtml
+ \return string DecodeString
+*/
+function dol_entity_decode($StringHtml)
+{
+ $DecodeString = html_entity_decode($StringHtml);
+ return $DecodeString;
+}
+
+/**
+ \brief Check if a string is a correct iso string
+ If not, it will we considered not HTML encoded even if it is by FPDF.
+ \remarks Example, if string contains euro symbol that has ascii code 128.
+ \param s String to check
+ \return int 0 if bad iso, 1 if good iso
+*/
+function dol_string_is_good_iso($s)
+{
+ $len=strlen($s);
+ $ok=1;
+ for($scursor=0;$scursor<$len;$scursor++)
+ {
+ $ordchar=ord($s{$scursor});
+ //print $scursor.'-'.$ordchar.'
';
+ if ($ordchar < 32 && $ordchar != 13 && $ordchar != 10) { $ok=0; break; }
+ if ($ordchar > 126 && $ordchar < 160) { $ok=0; break; }
+ }
+ return $ok;
+}
/**
\brief Encode une chaine de caractére