hey there,
i'm having a number of problems with inserting and retrieving extended
characters in Oracle (such as é) from a form.
The problem's present both with sending the characters, and with retrieving
them for display in HTML.
Has anyone else used HTML forms to send french characters to Oracle or
another DB?
there are no errors reported, and it does insert/retrieve values, just not
the proper ones. For example, é is inserted as a space, and retrieved as a
plain 'e' if i type it into oracle manually.
any ideas/input would be helpful.
claudia

code is pasted below.

the form for submitting words:

sub add {
 print <<"HTML_STUFF";
 <form method="post" action="keywords.ipl"
accept-charset="ISO-8859-1,ISO646-FR">
 <p align="left"><font face="arial" size="2"><b>Add Keywords</b></font></p>
 <p align="left"><font face="arial" size="2">Enter keywords, one per line,
below. When finished, click "Submit". </p>
 <p align="left">
 <TEXTAREA NAME="keywords" ROWS=6 COLS=30>
        </TEXTAREA>
 <input type="hidden" name="language" value="$language">
 <input type="hidden" name="choose" value="$choose">
 </p>
  <p align="left"> <input type="submit" name="Submit" value="Submit"></p>
 </form>
HTML_STUFF

}

the code to split the submitted text field up into individual words and send
them to the database:
sub addsub {

 $language =~ s/^\s+//;
 $language =~ s/\s+$//;
 my $keywords = $query->param('keywords');
 print "$keywords<BR>\n";
 $keywords =~ s/%(..)/pack("C",hex($1))/eg;
 print "$keywords<BR>\n";
 my @words = split(/\n/, $keywords);
 my $word;
 my $line;
 my $count;
 my @new;
 my @old;
 my $kwcount = "/opt/iw-home/httpd/iw-bin/countkw.txt";

 my $sth = $dbh->prepare(q{INSERT into KEYWORD (KEYWORD_ID, KEYWORD_NAME,
LANG) values (?, ?, ?)});
 my $sth2 = $dbh->prepare(q{select * from keyword where lang = ? and
keyword_name = ? });
 foreach $word(@words) {
 $word =~ s/^\s+//;       # trim leading whitespace
 $word =~ s/\s+$//;       # trim trailing whitespace
 $sth2->execute($language, $word);
 while (my @results = $sth2->fetchrow_array) {
  }
 my $rowcount = $sth2->rows;
 $sth2->finish;
 if ($rowcount < 1) {
  push(@new, $word);
  open COUNT, "$kwcount" or die "Couldn't open data file\n";
  while ($line = <COUNT>) {
   chomp $line;
   $count = $line;
   $count++;
   }
  close COUNT;
  open(COUNT, "+> $kwcount") or die "couldnt open file\n";
  print COUNT $count;
  close COUNT;
  $sth->execute($count, $word, $language);
  }
 else {
  push(@old, $word);
  }
 }
 $sth->finish;

 print <<"HTML_STUFF";
 <p align="left"><font face="arial" size="2"><b>The following keywords have
been added:</b></font></p>
 <p align="left"><font face="arial" size="2">
HTML_STUFF

 foreach $word(@new) {
  print "$word <BR>\n";
  }
 print "</font></p>\n";
 print "<p><font face=\"arial\" size=\"2\">The following words were already
in the database:</font></p>\n";
 print "<p><font face=\"arial\" size=\"2\">";
 foreach $word(@old) {
  print "$word<br>\n";
 }
 print "</font></p>\n";

}



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to