X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/489e7846289d4fb66eb4b9fab0fed4af719b98ee..e4c8bdafb631e419bdfdad87b6d80e17470044c4:/selfforum-cgi/shared/Encode/Plain.pm diff --git a/selfforum-cgi/shared/Encode/Plain.pm b/selfforum-cgi/shared/Encode/Plain.pm index f2085ce..3deb755 100644 --- a/selfforum-cgi/shared/Encode/Plain.pm +++ b/selfforum-cgi/shared/Encode/Plain.pm @@ -17,8 +17,15 @@ use vars qw( %unimap $utf8 $v56 + $VERSION ); +################################################################################ +# +# Version check +# +$VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; + $v56 = eval {local $SIG{__DIE__}; require 5.6.0;}; ################################################################################ @@ -129,7 +136,6 @@ sub plain ($;$) { if ($except) { $new =~ s/($exreg)|/defined($1)?$1:'>'/eg; - $new =~ s/($exreg)|\|/defined($1)?$1:'|'/eg; $new =~ s/($exreg)|"/defined($1)?$1:'"'/eg; # the big hash @@ -164,7 +170,6 @@ sub plain ($;$) { # $new =~ s//>/g; - $new =~ s/\|/|/g; $new =~ s/"/"/g; # the big hash @@ -225,7 +230,7 @@ sub multiline ($) { # turn \n into
# - $string=~s/\n/
/g; + $string=~s!\n!
!g; # more than 1 space =>   # @@ -234,7 +239,7 @@ sub multiline ($) { # Single Spaces after
=>   # (save ascii arts ;) # - $string=~s/(?:^|(
))\s/($1?$1:'').' '/eg; + $string=~s!(?:^|())\s!($1?$1:'').' '!eg; # return # @@ -255,17 +260,11 @@ sub toUTF8 ($) { ? $$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