# #
# File: shared/Encode/Plain.pm #
# #
-# Authors: André Malo <nd@o3media.de>, 2001-04-12 #
+# Authors: André Malo <nd@o3media.de> #
# #
# Description: Encode text for HTML Output (entities, spaces) #
# #
$v56
);
+################################################################################
+#
+# Version check
+#
+# last modified:
+# $Date$ (GMT)
+# by $Author$
+#
+sub VERSION {(q$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'}
+
$v56 = eval {local $SIG{__DIE__}; require 5.6.0;};
################################################################################
if ($except) {
$new =~ s/($exreg)|</defined($1)?$1:'<'/eg;
$new =~ s/($exreg)|>/defined($1)?$1:'>'/eg;
- $new =~ s/($exreg)|\|/defined($1)?$1:'|'/eg;
$new =~ s/($exreg)|"/defined($1)?$1:'"'/eg;
# the big hash
#
$new =~ s/</</g;
$new =~ s/>/>/g;
- $new =~ s/\|/|/g;
$new =~ s/"/"/g;
# the big hash
# turn \n into <br>
#
- $string=~s/\n/<br>/g;
+ $string=~s!\n!<br />!g;
# more than 1 space =>
#
# Single Spaces after <br> =>
# (save ascii arts ;)
#
- $string=~s/(?:^|(<br>))\s/($1?$1:'').' '/eg;
+ $string=~s!(?:^|(<br(?:\s*/)?>))\s!($1?$1:'').' '!eg;
# return
#
? $$ref
: $ref;
- if ($v56) {
- no warnings 'utf8';
- $string =~ tr/\x80-\xff//CU;
- }
- else {
- $string =~ s
- {([\x80-\xff])}
- { chr((ord ($1) >> 6) | 192)
- .chr((ord ($1) & 191))
- }eg;
- }
+ $string =~ s
+ {([\x80-\xff])}
+ { chr((ord ($1) >> 6) | 192)
+ .chr((ord ($1) & 191))
+ }eg;
ref($ref)
? \$string
);
}
-# keeping require happy
+# keep 'require' happy
1;
#