encoding problem on Tk entry widget

Discussion in 'Perl Misc' started by filippo, May 17, 2007.

  1. filippo

    filippo Guest

    I have a strange problem, probably due to encoding:

    my database tables (postgresql) have Latin9 encoding and stores
    italian names (a e i o u with accent). I can retrieve these names and
    load into entry widgets but if I copy-back these into database (from
    entry widgets just loaded), these letters change to strange not-ascii
    char.

    I would not be a database problem because if I print to video the sql
    insert strings, these contains the altready corrupted words.

    How can I solve this problem?

    Thanks,
    Filippo
     
    filippo, May 17, 2007
    #1
    1. Advertising

  2. filippo

    Ch Lamprecht Guest

    filippo wrote:
    > I have a strange problem, probably due to encoding:
    >
    > my database tables (postgresql) have Latin9 encoding and stores
    > italian names (a e i o u with accent). I can retrieve these names and
    > load into entry widgets but if I copy-back these into database (from
    > entry widgets just loaded), these letters change to strange not-ascii
    > char.
    >
    > I would not be a database problem because if I print to video the sql
    > insert strings, these contains the altready corrupted words.
    >
    > How can I solve this problem?
    >
    > Thanks,
    > Filippo
    >

    Hi,

    maybe a

    $dh->do("SET client_encoding TO 'UTF8'");

    could help.

    Christoph

    --
    use Tk;use Tk::GraphItems;$c=tkinit->Canvas->pack;push@i,Tk::GraphItems->
    TextBox(text=>$_,canvas=>$c,x=>$x+=70,y=>100)for(Just=>another=>Perl=>Hacker);
    Tk::GraphItems->Connector(source=>$i[$_],target=>$i[$_+1])for(0..2);
    $c->repeat(30,sub{$_->move(0,4*cos($d+=3.16))for(@i)});MainLoop
     
    Ch Lamprecht, May 17, 2007
    #2
    1. Advertising

  3. filippo

    filippo Guest

    On 17 Mag, 10:45, Ch Lamprecht <> wrote:

    > filippo wrote:
    >
    > $dh->do("SET client_encoding TO 'UTF8'");



    thanks today I will try it.

    I understand that could be a encoding problem between db (latin9) and
    windows (utf8).

    I know it's of topic here, but do you know how can I convert my
    database from LATIN9 to UTF8 to avoid such problems?

    Thanks,

    Filippo
     
    filippo, May 18, 2007
    #3
  4. filippo

    Ch Lamprecht Guest

    filippo wrote:
    > On 17 Mag, 10:45, Ch Lamprecht <> wrote:


    >>
    >> $dh->do("SET client_encoding TO 'UTF8'");

    >
    >
    >
    > thanks today I will try it.
    >
    > I understand that could be a encoding problem between db (latin9) and
    > windows (utf8).
    >
    > I know it's of topic here, but do you know how can I convert my
    > database from LATIN9 to UTF8 to avoid such problems?
    >
    > Thanks,
    >
    > Filippo
    >

    Hi,

    you won't have problems if you set your client_encoding to something your client
    can handle. However, if you want to convert your database encoding, you will
    have to dump the database (using pg_dump), recreate it with encoding set to UTF8
    (CREATE DATABASE your_database_name WITH ENCODING = 'UTF8') and restore from
    your backup file (using psql).

    HTH, Christoph


    --
    use Tk;use Tk::GraphItems;$c=tkinit->Canvas->pack;push@i,Tk::GraphItems->
    TextBox(text=>$_,canvas=>$c,x=>$x+=70,y=>100)for(Just=>another=>Perl=>Hacker);
    Tk::GraphItems->Connector(source=>$i[$_],target=>$i[$_+1])for(0..2);
    $c->repeat(30,sub{$_->move(0,4*cos($d+=3.16))for(@i)});MainLoop
     
    Ch Lamprecht, May 18, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marek S.

    Entry Widget problem

    Marek S., Jun 30, 2006, in forum: Python
    Replies:
    0
    Views:
    416
    Marek S.
    Jun 30, 2006
  2. Andras Szabo

    Tkinter / Entry widget problem

    Andras Szabo, Jul 13, 2009, in forum: Python
    Replies:
    2
    Views:
    503
    John McMonagle
    Jul 15, 2009
  3. Replies:
    0
    Views:
    344
  4. Frederic Rentsch
    Replies:
    0
    Views:
    259
    Frederic Rentsch
    Jul 8, 2012
  5. Terry Reedy
    Replies:
    15
    Views:
    648
    Frederic Rentsch
    Jul 16, 2012
Loading...

Share This Page