From afccfe875211ce45aefed6f035710ff01e8afc90 Mon Sep 17 00:00:00 2001 From: gbateson Date: Fri, 11 May 2007 05:11:55 +0000 Subject: [PATCH] when inserting 'Give Up' button, if site encoding is not iso-8859-1, then set page encoding to get_string('thischarset') --- mod/hotpot/view.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/mod/hotpot/view.php b/mod/hotpot/view.php index 5275a678c33..aaba7e14765 100644 --- a/mod/hotpot/view.php +++ b/mod/hotpot/view.php @@ -426,10 +426,23 @@ break; } // end switch $framename break; - default: - // HOTPOT_NAVIGATION_BUTTONS - // HOTPOT_NAVIGATION_GIVEUP - // HOTPOT_NAVIGATION_NONE + case HOTPOT_NAVIGATION_GIVEUP: + // replace charset , if necessary + // HotPots are plain ascii (iso-8859-1) with unicode chars encoded as HTML entities + $charset = get_string("thischarset"); + if ($charset == 'iso-8859-1') { + // do nothing + } else { + $hp->html = preg_replace( + '|]*charset=iso-8859-1[^>]*>|is', + '', + $hp->html + ); + } + // no break (continue to print html to browser) + default: + // HOTPOT_NAVIGATION_BUTTONS + // HOTPOT_NAVIGATION_NONE if (!empty($available_msg)) { $hp->insert_message('', $available_msg); }