if you may, could you tell which they are?
they may not depend on iso-8859-, just happen to be created that way then you may *fix* that problem.
also there is no db schema to be change all your code should stay the same, it will only affect the data stored so in theory the change should not be a problem, you could replicate your environment to test if your other code is affected by it.
Even if it's more work it's better to correct the error then to work around it :)
On 4/11/06, Daniel Vogelheim <
[EMAIL PROTECTED]> wrote:
Hello all,
Many thanks for your kind help. Unfortunately, I haven't found a
solution to my problem yet, but I think with your comments I now
understand it a lot better... :-)
Jorge and Italo wrote:
> [... kid.encoding in dev.cfg, encoding in kid templates ...]
My kid template encoding was 'iso-8859-1'. I indeed didn't have
kid.encoding set in the dev.cfg file. I have that now, but that
unfortunately hasn't changed my results. I experimented with different
setttings, too, but none of that seems to solve my problem.
Italo Maia wrote:
>One more thing, prefer unicodecol to stringcol.
I guess this really pinpoints my problem. I use:
class sqlmeta:
fromDatabase = True
in my models. The database contains columns with iso-8859-1 text. (The
database was generated with and is currently maintained by a
non-TurboGears application.) What I think happens is that the kid
system retrieves 8-bit strings with iso-8859-1 characters in it from
the model, and then tries to convert it to unicode strings.
Unfortunately, no-one told it which encoding to use, so it tries
'ascii', and then (rightly) throws an exception when it finds a
non-Ascii character.
I gather from your comments that it would be best to just change the
table definition(s). The problem is that I also use other programs to
access the same database, so I can't easily change my table structure.
Changing the table structure would make it really easy for TurboGears,
but I would have to put in all the work elsewhere, so that's cheating.
:-) I plan to convert it all over to Python & TurboGears eventually,
but since this is only a weekend project, that will take some more
time.
So... I think with your help I now know a high-effort way to solve my
problem. What I would really like to do is find a more TurboGears-like
way :) in which I could somehow tell SQLObject (or whichever other
component is responsible) that my database has 'iso-8859-1' column
data, and have the system handle the conversions automatically.
Any ideas? Am I overlooking something? Is there a better approach?
Thanks again!
Sincerely,
Daniel
P.S.: Here is a transcript of the exception that is throw. I can't
really read a whole lot out of it, but maybe someone else could.
-----------------------------
500 Internal error
The server encountered an unexpected condition which prevented it from
fulfilling the request.
Page handler: <bound method Root.db2 of <stammbaum.controllers.Root
object at 0x01C21090>>
Traceback (most recent call last):
File
"c:\dev\python\lib\site-packages\CherryPy-2.2.0-py2.4.egg\cherrypy\_cphttptools.py",
line 106, in _run
self.main()
File
"c:\dev\python\lib\site-packages\CherryPy- 2.2.0-py2.4.egg\cherrypy\_cphttptools.py",
line 255, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in db2
File
"c:\dev\python\lib\site-packages\TurboGears- 0.9a4-py2.4.egg\turbogears\controllers.py",
line 211, in expose
output = database.run_with_transaction(expose._expose,func,
accept, allow_json, allow_json_from_config,*args, **kw)
File
"c:\dev\python\lib\site-packages\TurboGears- 0.9a4-py2.4.egg\turbogears\database.py",
line 216, in run_with_transaction
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File
"c:\dev\python\lib\site-packages\TurboGears- 0.9a4-py2.4.egg\turbogears\controllers.py",
line 232, in <lambda>
expose._expose.when(rule)(lambda _func, accept, allow_json,
allow_json_from_config,*args,**kw: _execute_func(
File
"c:\dev\python\lib\site-packages\TurboGears- 0.9a4-py2.4.egg\turbogears\controllers.py",
line 265, in _execute_func
return _process_output(output, template, format, content_type,
mapping, fragment)
File
"c:\dev\python\lib\site-packages\TurboGears- 0.9a4-py2.4.egg\turbogears\controllers.py",
line 56, in _process_output
mapping=mapping, content_type=content_type,fragment=fragment)
File
"c:\dev\python\lib\site-packages\TurboGears-0.9a4-py2.4.egg\turbogears\view\base.py ",
line 131, in render
return engine.render(**kw)
File
"c:\dev\python\lib\site-packages\TurboKid-0.9.3-py2.4.egg\turbokid\kidsupport.py",
line 154, in render
return t.serialize(encoding= self.defaultencoding, output=format,
fragment=fragment)
File
"c:\dev\python\lib\site-packages\kid-0.9.1-py2.4.egg\kid\__init__.py",
line 236, in serialize
return serializer.serialize(self, encoding, fragment)
File
"c:\dev\python\lib\site-packages\kid-0.9.1-py2.4.egg\kid\serialization.py",
line 51, in serialize
text = list(self.generate(stream, encoding, fragment))
File
"c:\dev\python\lib\site-packages\kid- 0.9.1-py2.4.egg\kid\serialization.py",
line 327, in generate
for ev, item in self.apply_filters(stream):
File
"c:\dev\python\lib\site-packages\kid-0.9.1-py2.4.egg\kid\serialization.py",
line 84, in balancing_filter
for ev, item in stream:
File
"c:\dev\python\lib\site-packages\kid-0.9.1-py2.4.egg\kid\pull.py",
line 206, in _coalesce
for ev, item in stream:
File
"c:\dev\python\lib\site-packages\kid- 0.9.1-py2.4.egg\kid\filter.py",
line 21, in transform_filter
for ev, item in apply_matches(stream, template, templates,
apply_func):
File
"c:\dev\python\lib\site-packages\kid-0.9.1-py2.4.egg\kid\filter.py ",
line 25, in apply_matches
for ev, item in stream:
File
"c:\dev\python\lib\site-packages\kid-0.9.1-py2.4.egg\kid\pull.py",
line 164, in _track
for p in stream:
File
"c:\dev\python\lib\site-packages\kid- 0.9.1-py2.4.egg\kid\pull.py",
line 214, in _coalesce
text += to_unicode(value, encoding)
File
"c:\dev\python\lib\site-packages\kid-0.9.1-py2.4.egg\kid\pull.py",
line 190, in to_unicode
return unicode(value, encoding)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position
1: ordinal not in range(128)
Powered by CherryPy 2.2.0
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- [TurboGears] Re: where set sqlite encoding? Jorge Vargas
- [TurboGears] Re: where set sqlite encoding? Daniel Vogelheim
- [TurboGears] Re: where set sqlite encoding? Jorge Vargas
- [TurboGears] Re: where set sqlite encoding? Daniel Vogelheim
- [TurboGears] Re: where set sqlite encoding? Jorge Godoy
- [TurboGears] Re: where set sqlite encoding? Martina Oefelein

