From 3b696b42a5ce9d729e7c52c6907f3abb87b0728c Mon Sep 17 00:00:00 2001 From: Geoff Goehle Date: Mon, 20 Jun 2016 20:57:44 -0400 Subject: [PATCH 1/3] Add UTF8 to xmlrpc --- lib/WeBWorK/PG/IO.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/WeBWorK/PG/IO.pm b/lib/WeBWorK/PG/IO.pm index 0990606be6..feecdfa0f8 100644 --- a/lib/WeBWorK/PG/IO.pm +++ b/lib/WeBWorK/PG/IO.pm @@ -139,7 +139,7 @@ sub read_whole_file { unless path_is_course_subdir($filePath); local (*INPUT); - open(INPUT, "<$filePath") || die "$0: read_whole_file subroutine:
Can't read file $filePath"; + open(INPUT, "<:utf8", $filePath) || die "$0: read_whole_file subroutine:
Can't read file $filePath"; local($/)=undef; my $string = ; # can't append spaces because this causes trouble with <<'EOF' \nEOF construction close(INPUT); From d2d636c1f79a66ccd0d719c9f576db0820a041d6 Mon Sep 17 00:00:00 2001 From: Geoff Goehle Date: Fri, 15 Jul 2016 12:02:18 -0400 Subject: [PATCH 2/3] Add utf8 encoding to the base64 methods. --- lib/PGcore.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/PGcore.pm b/lib/PGcore.pm index fc4794fea9..b2f12f80bd 100755 --- a/lib/PGcore.pm +++ b/lib/PGcore.pm @@ -29,6 +29,7 @@ use Tie::IxHash; use WeBWorK::Debug; use MIME::Base64(); use PGUtil(); +use Encode qw(encode_utf8 decode_utf8); ################################## # PGcore object @@ -563,13 +564,15 @@ sub PG_restricted_eval { sub decode_base64 ($) { my $self = shift; my $str = shift; - MIME::Base64::decode_base64($str); + $str = MIME::Base64::decode_base64($str); + decode_utf8($str); } sub encode_base64 ($;$) { my $self = shift; my $str = shift; my $option = shift; + $str = encode_utf8($str); MIME::Base64::encode_base64($str); } From 539406cc210c8c6d421f3650797f13e6245e712c Mon Sep 17 00:00:00 2001 From: Geoff Goehle Date: Wed, 17 Aug 2016 16:43:46 -0400 Subject: [PATCH 3/3] picked an ascii character for the verb escape character so that it doesn't interfere with utf8 --- lib/Value/String.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Value/String.pm b/lib/Value/String.pm index 438a10f8b0..bf9022f705 100644 --- a/lib/Value/String.pm +++ b/lib/Value/String.pm @@ -72,7 +72,7 @@ sub compare { # # Mark a string to be display verbatim # -sub verb {shift; return "\\verb".chr(0x85).(shift).chr(0x85)} +sub verb {shift; return "\\verb".chr(0x1F).(shift).chr(0x1F)} # # Put normal strings into \text{} and others into \verb