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