perl-unicode

AW: charsets generally and with lwp

2009-10-22 14:50:43

Hello folks

I have solved the encoding-problem as follow. First of all I used from the
LWP-Module the method decoded_content() of the Response class.
Additonal I made the mistake to write the sql-string not encoded in all.

I have written:

$db->Sql( "INSERT into results VALUES('" . $datum  . "','" . 
encode("iso-8859-1", $headline) . "','" . $company . "','" . $message . "','" . 
$content . "') ) ;

instead of

$db->Sql( encode("iso-8859-1", "INSERT into results VALUES('" . $datum  . "','" 
. $headline . "','" . $company . "','" . $message . "','" . $content . "')") );

Thanks for all Help!

Bye 
Hilde




________________________________
Von: Avraham Shapiro <asha(_at_)loc(_dot_)gov>
An: "Luebkert, Bill" <dbecoll(_at_)roadrunner(_dot_)com>; "Schedthelm, 
Hildegard" <hilde(_dot_)schwed(_at_)yahoo(_dot_)de>
Gesendet: Donnerstag, den 22. Oktober 2009, 16:07:13 Uhr
Betreff: Re: charsets generally and with lwp


Try making sure you have

use open ':utf8';
use open ':std';
 
in your code.  Set the environment variable PERLIO to ':utf8' before you run.
This works for me.
 
Good luck
Bill Luebkert <dbecoll(_at_)roadrunner(_dot_)com> 10/21/09 3:26 PM >>>

Hildegard Schedthelm wrote:
Hello folks

I've some troubles with a perlscript that you can see below.
The problem is that some german special characters (umlaut) are not 
displayed as
they should be. This seems to be an encoding-issue. Either the internal
perl variables have the wrong encoding or the lwp-module when grapping 
the html?
Additional the output to write the data into the MS-Access DB can also 
have the
incorrect encoding. How can we fix the uncertainty? What can I do to 
ensure the
right encoding in all levels?

Your retrieval part looks ok.  I would just dump the data in hex prior
to insertion in the DB and verify it's what you want.  That just leaves
the DB if all is well going in.  If the DB is converting it, you could
consider your own conversion on entry and exit to the DB if you're also
using Perl to query the DB - if not, and there is some conversion going
on going into the DB I would check ODBC for options that may alleviate
the problem.  (I haven't played with ODBC much.)

_______________________________________________
ActivePerl mailing list
ActivePerl(_at_)listserv(_dot_)ActiveState(_dot_)com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



      
<Prev in Thread] Current Thread [Next in Thread>
  • AW: charsets generally and with lwp, Hildegard Schedthelm <=