All pastes #451997 Raw Edit

Stuff

public text v1 · immutable
·published 2007-04-21 23:48 UTC
rendered paste body
  # prepare text
  # antiplenk
  $text =~ s/\s+,/,/g;
  $text =~ s/\s+\.[^\.]/./g;
  $text =~ s/\s+\?/?/g;
  $text =~ s/\s+!/!/g;

  $text =~ s/\?+$/?/g;

  # bad special chars
  $text =~ s/ü/ue/g;
  $text =~ s/Ü/Ue/g;
  $text =~ s/ä/ae/g;
  $text =~ s/Ä/Ae/g;
  $text =~ s/ö/oe/g;
  $text =~ s/Ö/Oe/g;
  $text =~ s/ß/ss/g;

  # Convert a string in 'UTF8' encoding to encoding 'ISO-8859-1'
  use Unicode::MapUTF8 qw(to_utf8 from_utf8 utf8_supported_charset);
  my $new_text = from_utf8({ -string => $text, -charset => 'ISO-8859-15' });

  #$self->lux->msg("#ubuntu-de-bot", "UTF->ISO \$new_text = '$new_text'");

  # was UTF-8?
  $text = $new_text if ( $new_text ne "?" );

  # bad special chars
  $text =~ s/ü/ue/g;
  $text =~ s/Ü/Ue/g;
  $text =~ s/ä/ae/g;
  $text =~ s/Ä/Ae/g;
  $text =~ s/ö/oe/g;
  $text =~ s/Ö/Oe/g;
  $text =~ s/ß/ss/g;

  #$self->lux->msg("#ubuntu-de-bot", "ISO->UNI     \$text = '$text'");