Hello guys,

i now tried to figure it out more precisely.

When i pass a character set in the connection dsn ( "interbase://
user:[EMAIL PROTECTED]:3050/path/to/file.gdb?charset=ISO8859_1"), i
receive an error like this:

###########################
>>> for row in rs:
...     print row.ZIEL # column i know contains special characters
...
Traceback (most recent call last):
  File "<console>", line 1, in ?
  File "c:\python24\lib\site-packages\SQLObject-0.7.3-py2.4.egg
\sqlobject\sresults.py", line 155, in __iter__
    return iter(list(self.lazyIter()))
  File "c:\python24\lib\site-packages\SQLObject-0.7.3-py2.4.egg
\sqlobject\sresults.py", line 163, in lazyIter
    return conn.iterSelect(self)
  File "c:\python24\lib\site-packages\SQLObject-0.7.3-py2.4.egg
\sqlobject\dbconnection.py", line 776, in iterSelect
    select, keepConnection=True)))
  File "c:\python24\lib\site-packages\SQLObject-0.7.3-py2.4.egg
\sqlobject\dbconnection.py", line 711, in next
    result = self.cursor.fetchone()
ProgrammingError: (-802, 'fetch: \n  arithmetic exception, numeric
overflow, or string truncation\n  Cannot transliterate character
between character sets')
>>>
####################################


if i don´t pass a character set in the dsn and do

######################################
>>> from ratio import * #import legacy model
>>> rs = Reisen.selectBy(REISENR='06SIO/1509') #select a row that i know
                                               #it contains special
characters
>>> for row in rs:
...     print row.ZIEL # print a column that i know contains special
characters
...
Si‗fok/Ungarn
#-^ this is where the special-character 'ó' should have been =>
"Siófok"
#######################################


and when i finally try:
########################################
>>> for row in rs:
...     print row.ZIEL.encode('iso-8859-1') # or with any other char-
set
...
Traceback (most recent call last):
  File "<console>", line 2, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf2 in position
2: ordinal
not in range(128)
#########################################



called the vendor of the legacy database once more - they say "we don
´t define any character sets in our database" - the metadata of the
IBconsole doesn´t tell anything about a character-set as well, but it
´s treating the special characters right...


any more ideas?

Regards,
Frank


On 7 Mrz., 10:26, "Johnny Blonde" <[EMAIL PROTECTED]>
wrote:
> hello mikkel,
>
> i can make a connection to and retrieve data from it. it is a
> interbase 6.
> usually all the interbase/firebird stuff is compatible backwards to
> the older versions.
> and as i just need read-only access most connections succeed.
>
> hello oleg,
>
> thanks for your comment, i´ll try to figure out the character set used
> in the database and will then try to change the DSN.
>
> i´ll let you know.
>
> Regards, Frank
>
> On 6 Mrz., 20:25, "Mikkel Høgh" <[EMAIL PROTECTED]> wrote:
>
> > I do not think that Interbase is supported by SQLObject. According 
> > tohttp://www.sqlobject.org/SQLObject.html#requirements
> > Interbase is specifically not mentioned, although Firebird is, using
> > the same library to connect.
>
> > According tohttp://kinterbasdb.sourceforge.net/onlysome versions of
> > Interbase are supported by kinterbasdb...
>
> > On Mar 6, 6:24 pm, "Johnny Blonde" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hello everybody...
>
> > > I have an application with two databases (wrote about it here before).
> > > one is a legacy database (interbase) and the application-database is a
> > > postgreSQL.
>
> > > Everything is running smoothly in unicode from the postgreSQL to the
> > > webbrowser back and forth, without anything specially done by me.
>
> > > But when i retreive data form the legace (interbase) database all my
> > > special characters (german umlauts (äöüß) and others (ó etc)) are
> > > smashed.
>
> > > what can i do about it?
>
> > > here´s all (?) my relevant code:
>
> > > ################ DEV.CFG ###################
> > > # connection strings of the main and the legacy database
> > > # this one works just perfectly:
> > > sqlobject.dburi="postgres://user:[EMAIL PROTECTED]/database"
> > > # BUT this one doesn´t:
> > > app.legacy.dburi="interbase://user:[EMAIL PROTECTED]:3050/path/to/
> > > file.gdb"
>
> > > ################ LEGACY.PY ##################
> > > from datetime import datetime
> > > from turbogears.database import PackageHub
> > > from sqlobject import *
>
> > > hub = PackageHub("app.legacy")
> > > __connection__ = hub
>
> > > class Teilnehmer(SQLObject):
> > >     class sqlmeta:
> > >         fromDatabase=True
> > >         idName="NR"
>
> > > class Reisen(SQLObject):
> > >     class sqlmeta:
> > >         fromDatabase=True
> > >         idName="NR"
>
> > > ############### CONTROLLERS.PY #############
> > > class Root(controllers.RootController):
> > >     @expose(template="app.templates.welcome")
> > >     @identity.require(identity.in_group("admin"))
> > >     def index(self):
> > >         orte = Ort.select() # testdata being passed in
> > >         reisen = Reisen.select(LIKE(Reisen.q.REISENR, u'%SIO%')) #
> > > testdata being passed in
> > >         import time
> > >         # log.debug("Happy TurboGears Controller Responding For Duty")
> > >         return dict(now=time.ctime(), orte=orte, reisen=reisen)
>
> > > ############## WELCOME.KID #################
> > >     <div>
> > >         <span py:replace="orte">Orte goes here.</span>
> > >     </div>
>
> > > -- PRODUCES (EXAMPLE):
> > > <Ort 1 code=u'LLO' name=u'Lloret de Mar' regionID=1><Ort 2 code=u'CAL'
> > > name=u'Calella' regionID=1><Ort 3 code=u'SIO' name=u'Si\xf3fok'
> > > regionID=2>
>
> > >                 <ul>
> > >                         <li py:for="reisenr in reisen">
> > >                                 <!-- this one works as it contains no 
> > > special character -->
> > >                                 <span py:content="reisenr.REISENR">Page 
> > > Name Here.</span>
> > >                                 <!-- but this one doesn´t as it contains 
> > > strings like
> > > "Siófok"  -->
> > >                                 <span py:content="reisenr.ZIEL">Ziel 
> > > here.</span>
> > >                     </li>
>
> > > and finally the
> > > ################## ERROR TRACEBACK ##################
> > > Page handler: <bound method Root.index of
> > > <tagderabrechnung2.controllers.Root object at 0x015C55F0>>
> > > Traceback (most recent call last):
> > >   File "c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy
> > > \_cphttptools.py", line 105, in _run
> > >     self.main()
> > >   File "c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy
> > > \_cphttptools.py", line 254, in main
> > >     body = page_handler(*virtual_path, **self.params)
> > >   File "<string>", line 3, in index
> > >   File "c:\python24\lib\site-packages\TurboGears-1.0.1-py2.4.egg
> > > \turbogears\controllers.py", line 334, in expose
> > >     output = database.run_with_transaction(
> > >   File "<string>", line 5, in run_with_transaction
> > >   File "c:\python24\lib\site-packages\TurboGears-1.0.1-py2.4.egg
> > > \turbogears\database.py", line 302, in so_rwt
> > >     retval = func(*args, **kw)
> > >   File "<string>", line 5, in _expose
> > >   File "c:\python24\lib\site-packages\TurboGears-1.0.1-py2.4.egg
> > > \turbogears\controllers.py", line 351, in <lambda>
> > >     mapping, fragment, args, kw)))
> > >   File "c:\python24\lib\site-packages\TurboGears-1.0.1-py2.4.egg
> > > \turbogears\controllers.py", line 391, in _execute_func
> > >     return _process_output(output, template, format, content_type,
> > > mapping, fragment)
> > >   File "c:\python24\lib\site-packages\TurboGears-1.0.1-py2.4.egg
> > > \turbogears\controllers.py", line 82, in _process_output
> > >     fragment=fragment)
> > >   File "c:\python24\lib\site-packages\TurboGears-1.0.1-py2.4.egg
> > > \turbogears\view\base.py", line 131, in render
> > >     return engine.render(**kw)
> > >   File "c:\python24\lib\site-packages\TurboKid-0.9.9-py2.4.egg\turbokid
> > > \kidsupport.py", line 174, in render
> > >     return t.serialize(encoding=self.defaultencoding, output=format,
> > > fragment=fragment)
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \__init__.py", line 299, in serialize
> > >     raise_template_error(module=self.__module__)
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \__init__.py", line 297, in serialize
> > >     return serializer.serialize(self, encoding, fragment, format)
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \serialization.py", line 105, in serialize
> > >     text = ''.join(self.generate(stream, encoding, fragment, format))
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \serialization.py", line 630, in generate
> > >     for ev, item in self.apply_filters(stream, format):
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \serialization.py", line 163, in format_stream
> > >     for ev, item in stream:
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \parser.py", line 219, in _coalesce
> > >     for ev, item in stream:
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \serialization.py", line 478, in inject_meta_tags
> > >     for ev, item in stream:
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \parser.py", line 177, in _track
> > >     for p in stream:
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \filter.py", line 30, in apply_matches
> > >     item = stream.expand()
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \parser.py", line 106, in expand
> > >     for ev, item in self._iter:
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \parser.py", line 177, in _track
> > >     for p in stream:
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \parser.py", line 227, in _coalesce
> > >     text += to_unicode(value, encoding)
> > >   File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> > > \parser.py", line 204, in to_unicode
> > >     return unicode(value, encoding)
> > > TypeError: function takes exactly 5 arguments (1 given)
>
> > > how to prevent this error and how to ensure a straight handling of the
> > > character encoding of the legacy database? - the legacy-database
> > > vendor (producer of the horrible database schema) told me that there
> > > was no character set defined during database creation.
>
> > > Any ideas?
>
> > > Thanks a lot for your help,
> > > Frank
> > >                 </ul>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to