33 * Functions that are specific to HIS database, format and helptables containing his-formatted data
44 */
55defined ('MOODLE_INTERNAL ' ) || die ();
6+ global $ CFG ;
67require_once ($ CFG ->dirroot . '/local/lsf_unification/class_pg_lite.php ' );
78
89define ("HIS_PERSONAL " , "public.learnweb_personal " );
@@ -278,7 +279,7 @@ function get_default_fullname($lsf_course) {
278279 foreach (get_teachers_of_course ($ lsf_course ->veranstid ) as $ person ) {
279280 $ personen .= ", " . trim ($ person ->vorname ) . " " . trim ($ person ->nachname );
280281 }
281- return utf8_encode (($ lsf_course ->titel ) . " " . trim ($ lsf_course ->semestertxt ) . $ personen );
282+ return mb_convert_encoding (($ lsf_course ->titel ) . " " . trim ($ lsf_course ->semestertxt ) . $ personen, ' UTF-8 ' , ' ISO-8859-1 ' );
282283}
283284
284285/**
@@ -294,8 +295,7 @@ function get_default_shortname($lsf_course, $long = false) {
294295 foreach (explode (" " , $ lsf_course ->titel ) as $ word ) {
295296 $ i .= strtoupper ($ word [0 ]) . (($ long && !empty ($ word [1 ])) ? $ word [1 ] : "" );
296297 }
297- $ name = utf8_encode (
298- $ i . "- " . substr ($ lsf_course ->semester , 0 , 4 ) . "_ " . substr ($ lsf_course ->semester , -1 ));
298+ $ name = mb_convert_encoding ($ i . "- " . substr ($ lsf_course ->semester , 0 , 4 ) . "_ " . substr ($ lsf_course ->semester , -1 ), 'UTF-8 ' , 'ISO-8859-1 ' );
299299 if (!$ long && $ DB ->record_exists ('course ' , array ('shortname ' => $ name
300300 ))) {
301301 return get_default_shortname ($ lsf_course , true );
@@ -321,7 +321,7 @@ function get_default_summary($lsf_course) {
321321 $ summary .= '<p> ' . $ sum_object ->kommentar . '</p> ' ;
322322 }
323323 }
324- $ summary = utf8_encode ($ summary ) . '<p><a href=" ' . $ lsf_course ->urlveranst .
324+ $ summary = mb_convert_encoding ($ summary, ' UTF-8 ' , ' ISO-8859-1 ' ) . '<p><a href=" ' . $ lsf_course ->urlveranst .
325325 '">Kurs im HIS-LSF</a></p> ' ;
326326 return $ summary ;
327327}
@@ -595,7 +595,7 @@ function insert_missing_helptable_entries($debugoutput = false, $tryeverything =
595595 $ entry ->origin = find_origin_category ($ hislsf_title ->ueid );
596596 $ entry ->mdlid = 0 ;
597597 $ entry ->timestamp = strtotime ($ hislsf_title ->zeitstempel );
598- $ entry ->txt = utf8_encode ($ hislsf_title ->txt );
598+ $ entry ->txt = mb_convert_encoding ($ hislsf_title ->txt , ' UTF-8 ' , ' ISO-8859-1 ' );
599599 if ($ debugoutput )
600600 echo "! " ;
601601 try {
@@ -605,7 +605,7 @@ function insert_missing_helptable_entries($debugoutput = false, $tryeverything =
605605 echo "x " ;
606606 } catch (Exception $ e ) {
607607 try {
608- $ entry ->txt = utf8_encode (delete_bad_chars ($ hislsf_title ->txt ));
608+ $ entry ->txt = mb_convert_encoding (delete_bad_chars ($ hislsf_title ->txt ), ' UTF-8 ' , ' ISO-8859-1 ' );
609609 $ DB ->insert_record ("local_lsf_category " , $ entry , true );
610610 $ records1_unique [$ hislsf_title ->ueid ] = true ;
611611 if ($ debugoutput )
@@ -655,7 +655,7 @@ function insert_missing_helptable_entries($debugoutput = false, $tryeverything =
655655 $ entry = $ DB ->get_record ('local_lsf_category ' ,
656656 array ("ueid " => $ hislsf_title ->ueid
657657 ));
658- $ entry ->txt2 = utf8_encode ($ fullname );
658+ $ entry ->txt2 = mb_convert_encoding ($ fullname, ' UTF-8 ' , ' ISO-8859-1 ' );
659659 try {
660660 $ DB ->update_record ('local_lsf_category ' , $ entry , true );
661661 } catch (Exception $ e ) {
@@ -685,7 +685,7 @@ function insert_missing_helptable_entries($debugoutput = false, $tryeverything =
685685 * @return $str
686686 */
687687function delete_bad_chars ($ str ) {
688- return strtr (utf8_encode ($ str ), array (
688+ return strtr (mb_convert_encoding ($ str, ' UTF-8 ' , ' ISO-8859-1 ' ), array (
689689 "\xc2\x96" => "" , // EN DASH
690690 "\xc2\x97" => "" , // EM DASH
691691 "\xc2\x84" => "" // DOUBLE LOW-9 QUOTATION MARK
0 commit comments