Permalink
Browse files

when inserting 'Give Up' button, if site encoding is not iso-8859-1, …

…then set page encoding to get_string('thischarset')
  • Loading branch information...
1 parent 78e4c3d commit afccfe875211ce45aefed6f035710ff01e8afc90 gbateson committed May 11, 2007
Showing with 17 additions and 4 deletions.
  1. +17 −4 mod/hotpot/view.php
View
@@ -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(
+ '|<meta[^>]*charset=iso-8859-1[^>]*>|is',
+ '<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />',
+ $hp->html
+ );
+ }
+ // no break (continue to print html to browser)
+ default:
+ // HOTPOT_NAVIGATION_BUTTONS
+ // HOTPOT_NAVIGATION_NONE
if (!empty($available_msg)) {
$hp->insert_message('<!-- BeginTopNavButtons -->', $available_msg);
}

0 comments on commit afccfe8

Please sign in to comment.