Currently you cannot. Support for legacy databases is not on the same
foot as support for databases created by web2py. In particular as you
point out the encoding is an issue.

One way around is use a custom field type.

On Nov 21, 8:58 am, Hans Murx <murxun...@googlemail.com> wrote:
> example:
>
> In [1]: db = DAL('informix://oli:x...@suse101/stammdat')
> In [2]: db.define_table("personen",
>    ...:     Field("name", length=80),
>    ...:     Field("anz", "integer"),
>    ...:     primarykey=["name"],
>    ...:     migrate=False
>    ...: )
> In [3]: a = db().select(db.personen.name)[0].name
> In [4]: print a
> Öläf
> In [5]: db(db.personen.name == a)._update(anz=2)
> Out[5]: "UPDATE personen SET anz=2 WHERE personen.name='\xc3\x96l
> \xc3\xa4f';"
> In [6]: print db(db.personen.name == a).update(anz=2)
> 0
>
> shows that 0 rows were updated although 1 row should have been
> updated.
>
> I think the cause of this problem is that the values in our database
> are not utf-8 but iso-8859-1encoded and web2py explicitly encodes
> values to uft-8 in funtion 'sql_represent' (gluon/sql.py) when
> creating sql-statemens for updates and inserts.
>
> How to talk to iso-8859-1 encoded legacy DBs?
>
> Regards,
>
>   Hans
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to