X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/dc3cd296e62eb09a16fa694d9b3a7158e4cf63bf..d7420ba874019aa197b978a738f89a15bfec08a7:/SL/Locale.pm diff --git a/SL/Locale.pm b/SL/Locale.pm index 1e4134455..2b662bf17 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -105,19 +105,44 @@ sub _init { } sub _handle_markup { - my $self = shift; - my $str = shift; + my $self = shift; + my $str = shift; - if ($str eq "\\n") { - return "\n"; - } elsif ($str eq "\\r") { - return "\r"; - } + my $escaped = 0; + my $new_str = ''; + + for (my $i = 0; $i < length $str; $i++) { + my $char = substr $str, $i, 1; + + if ($escaped) { + if ($char eq 'n') { + $new_str .= "\n"; + + } elsif ($char eq 'r') { + $new_str .= "\r"; + + } elsif ($char eq 's') { + $new_str .= ' '; + + } elsif ($char eq 'x') { + $new_str .= chr(hex(substr($str, $i + 1, 2))); + $i += 2; - $str =~ s/\\x(..)/chr(hex($1))/eg; - $str =~ s/\\(.)/$1/g; + } else { + $new_str .= $char; + } + + $escaped = 0; + + } elsif ($char eq '\\') { + $escaped = 1; + + } else { + $new_str .= $char; + } + } - return $str; + return $new_str; } sub _read_special_chars_file {