summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Util.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-04-03 23:58:28 +0200
committerlpsolit%gmail.com <>2008-04-03 23:58:28 +0200
commit59d76227caa0d8304f243bd8d2d8534ed6d80e81 (patch)
tree7803da80cbf7dc75851f032bdfacb9add8de5378 /Bugzilla/Util.pm
parent43b7dc314234e476a80d9acbd07292d7286cca5a (diff)
downloadbugzilla-59d76227caa0d8304f243bd8d2d8534ed6d80e81.tar.gz
bugzilla-59d76227caa0d8304f243bd8d2d8534ed6d80e81.tar.xz
Bug 410902: Some characters are mangled in diff and interdiff modes when viewing patches - Patch by Frédéric Buclin <LpSolit@gmail.com> r=shimono, r=mkanat a=LpSolit
Diffstat (limited to 'Bugzilla/Util.pm')
-rw-r--r--Bugzilla/Util.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index da41008e1..e7a76e21d 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -44,7 +44,7 @@ use base qw(Exporter);
file_mod_time is_7bit_clean
bz_crypt generate_random_password
validate_email_syntax clean_text
- get_text);
+ get_text disable_utf8);
use Bugzilla::Constants;
@@ -534,6 +534,12 @@ sub get_netaddr {
return join(".", unpack("CCCC", pack("N", $addr)));
}
+sub disable_utf8 {
+ if (Bugzilla->params->{'utf8'}) {
+ binmode STDOUT, ':raw'; # Turn off UTF8 encoding.
+ }
+}
+
1;
__END__
@@ -781,6 +787,10 @@ The search starts at $maxpos and goes back to the beginning of the string.
Returns true is the string contains only 7-bit characters (ASCII 32 through 126,
ASCII 10 (LineFeed) and ASCII 13 (Carrage Return).
+=item C<disable_utf8()>
+
+Disable utf8 on STDOUT (and display raw data instead).
+
=item C<clean_text($str)>
Returns the parameter "cleaned" by exchanging non-printable characters with spaces.
Specifically characters (ASCII 0 through 31) and (ASCII 127) will become ASCII 32 (Space).