Sfoglia il codice sorgente

Fix UTF8 issue on PDF

Alan Lam 8 anni fa
parent
commit
d7c9ec2301

+ 4 - 0
engine/util.php

@@ -1,6 +1,10 @@
 <?php
 <?php
 class Util {
 class Util {
 
 
+	public static function convertUTF8($string, $target_encoding = "CP1252") {
+		return mb_convert_encoding($string, $target_encoding, "UTF-8");
+	}
+
 	public static function getPaginationObject($array, $page_size = 25) {
 	public static function getPaginationObject($array, $page_size = 25) {
 		$item_count = count($array);
 		$item_count = count($array);
 
 

+ 1 - 1
template_processing/age_verification/test_pdf.php

@@ -155,7 +155,7 @@ $pdf->SetY($pdf->GetY() + 2);
 $pdf->SetFont("Arial");
 $pdf->SetFont("Arial");
 
 
 $pdf->SetFont("Arial", "", $small_font_size);
 $pdf->SetFont("Arial", "", $small_font_size);
-$pdf->MultiCell(90, 4, $test->additional_notes, 0, 1);
+$pdf->MultiCell(90, 4, Util::convertUTF8($test->additional_notes), 0, 1);
 $pdf->SetY($pdf->GetY() + 2);
 $pdf->SetY($pdf->GetY() + 2);
 
 
 // Challenge
 // Challenge

+ 1 - 1
template_processing/mystery_shop/test_pdf.php

@@ -123,7 +123,7 @@ $pdf->Cell(95, $cell_height, "Tester's Notes", 0, 1);
 $pdf->SetFont("Arial");
 $pdf->SetFont("Arial");
 
 
 $pdf->SetFont("Arial", "", $small_font_size);
 $pdf->SetFont("Arial", "", $small_font_size);
-$pdf->MultiCell(90, 4, $test->additional_notes, 0, 1);
+$pdf->MultiCell(90, 4, Util::convertUTF8($test->additional_notes), 0, 1);
 $pdf->SetY($pdf->GetY() + 2);
 $pdf->SetY($pdf->GetY() + 2);
 
 
 // Staff Details
 // Staff Details