By the way, do you know about this trick: reload(sys) sys.setdefaultencoding(encoding)
It gets around the site.py problem. Best Regards, -jj On 5/16/07, Jens Hoffrichter <[EMAIL PROTECTED]> wrote: > > Hey Voltron, > > > On 5/16/07, voltron <[EMAIL PROTECTED]> wrote: > > > > Oh I did not know about that, thanks Jens. Excuse my newbiness, but > > could you explain your method further? where is site.py? > The declaration for working with encodings in Python files is > described here, in PEP 263: > > http://www.python.org/dev/peps/pep-0263/ > > The site.py is normally located in your base library directory, for me > on Debian Linux it is > /usr/lib/python2.4, or maybe even /etc/python2.4/site.py > > Search for the string "ascii" in the file, and then you can see why it > is very hard to change the default encoding after this file is > executed. And site.py is automagically executed everytime you start > python ;) > > But, as I said, it is cumbersome, because you must have access to the > site.py file, and this isn't guaranteed, especially for a shared > hoster. > > There exists another solution, at least for normal python applications: > > You can place a file called "sitecustomize.py" in the directory of > your application (or maybe in the first library path for it, I'm not > sure, but that is normally the application path), where you can put in > something like that: > > ---- snip ---- > import sys > > sys.setdefaultencoding("UTF-8") > ---- snip ---- > > This works as well. I normally don't use it, and especially haven't > used it with pylons (because I'm actually on this list because I had a > Myghty caching question, and somehow stayed ;) ), but this is the only > solution python applications compiled with py2exe, as you have no > other method of setting the site.py there. > > But, as I said, I don't know how it would work in pylons, maybe > someone with a broader knowledge in pylons can look at it. > > Jens > > > > -- http://jjinux.blogspot.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---