Ok, but i'm not sure where to put that, as my script doesn't work in quite the same way as you think. Here's the script, if you can help. I know it looks very messy, but i'll clean it up after it works. ;-) Thanks again, Aled. ------------------------------------
use strict ; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use HTML::Template; use Data::Dumper; use Unicode::String; my $q = new CGI; print $q->header(); #my $template = "wsillafu.tmpl"; my $template = "bbc/lemma/wsillafu.tmpl"; my $tmpl = new HTML::Template( filename => $template, associate => $ +q ); my $errorchecker = "0";my $memoryoverloadchecker = "0"; my $memorych +ecker = "0"; my $dictionarychecker = "0";my $otherchecker = "0";my $memoryfinder += "0"; if ($q->param()) { (my $spellingcheck, my $error) = lookup($q->param("brawddeg +")); #print Dumper( $spellingcheck ); #print "error = $error<br>"; $tmpl->param( spellingcheck => $spellingcheck ); if($error == 1){$errorchecker = "1"; $memoryfinder = "1";} if($error == -1){$memoryoverloadchecker = "1"; $memoryfinder + = "1";} if($error == -2){$memorychecker = "1"; $memoryfinder = "1";} if($error == -3){$dictionarychecker = "1"; $memoryfinder = "1"; +} if($error == -4){$otherchecker = "1"; $memoryfinder = "1";} } print $tmpl->output; if( $dictionarychecker eq "1" ) { print "<br><br>Nid yw\'r geiriadur ar-lein ar gael. E-bostiw +ch meistr y wefan am gymorth \n"; } if( $otherchecker eq "1" ) { print "<br><br>Mae gwall yn y gwirydd. E-bostwich meistr y w +efan am gymorth \n"; } if( $memoryoverloadchecker eq "1" ) { print "<br><br>Roedd mwy na 10 gwall yn y testun. Dim ond y +10 gwall cyntaf sydd wedi ei cywiro.<br> Cywirwch rhain cyn cario ymlaen i gywiro.\n"; } if( $memorychecker eq "1" ) { print "<br><br>Mae'r gwirydd wedi rhedeg allan o gof. E-bost +iwch meistr y wefan am gymorth.\n"; } if( $errorchecker eq "1" ) { print "<br><br><font color=\"red\"><b>Mae rhai gwallau yng ng +horff y testun.</b></font><br> Dewiswch air â gynhigir yn y blwch tynnu i lawr i bob gair sy +dd wedi ei sillafu'n anghywir. <br>Yna gwagswch y botwm gwirio isod i gael eich testun wedi +ei wirio.<br>\n"; print "<form name=\"ArgraffyddTestun\" method=\"POST\" Action +=\"wsillafudangos.pl\">\n"; print "<input type=\"Submit\" name=\"Gwirio\" value=\"Gwirio\ +"></form>\n"; } if( $memoryfinder eq "0" ) {print "<br><br><b>Nid oedd gwall yn y + frawddeg</b>\n";} use lemma; sub lookup() { $_ = shift(@_); #print "Paramater: $_ \n"; #my $br = ""; #$br->String::latin1( $_ ); #print "Latin1 $br \n"; (my $errors, my $str) = lemma::GetCysillSpellingErrors($_, 10); #print "$str\n"; my @fields = split ("(<awgrymiadau>[^<]*</awgrymiadau>)", $str); #print Dumper(@fields); my $error = ( @fields > 1); my @spellingcheck = (); for(my $i=0; $i<@fields; $i+=2) { my %pair; if($i+1 == @fields) { %pair = (text=> @fields[$i]); } else { @fields[$i+1] =~ s/<[^>]*>//g; my @SuggestionList = split /,/, @fields[$i+1]; #print "SuggestionList = ",Dumper(@SuggestionList); my @suggestions = (); my $suggestion; foreach $suggestion (@SuggestionList) { my %hash = (suggestion=> $suggestion); push @suggestions, \%hash; } %pair = (text=> @fields[$i], thesuggestions=>\@suggestions) +; } push @spellingcheck, \%pair; } #print Dumper(@spellingcheck); return (\@spellingcheck, $errors) ; }
-----------------------

In reply to Re: ASCII to UTF-8 by COMSCBoy
in thread ASCII to UTF-8 by COMSCBoy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.