Thank you for answering; I had a feeling that some autoescape magic
might be at work.


Unfortunately I do not have the code here, but the django traceback
goes like this:

------------------------
Environment:

Request Method: GET
Request URL: http://devel.pc-horse.com/NewLicense/47/
Django Version: 1.2 beta 1 SVN-12494
Python Version: 2.5.2
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'sleipner.config',
 'sleipner.main',
 'sleipner.transactions',
 'sleipner.DIBS']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
in get_response
  101.                     response = callback(request,
*callback_args, **callback_kwargs)
File "/var/www/Django/devel/sleipner/main/license.py" in new
  58.         form = NewLicenseForm( country )
File "/var/www/Django/devel/sleipner/main/license.py" in __init__
  36.                 productList.append( (p.id , "%s %s %6.0f %s" %
(type.localized_name(country.id) ,
dur.localized_duration(country.id) , total_price , currency )) )
---------------------------------------------

The return value from the function "dur.localilized_duration( )"
contains a "å" and that is what it brings it down. I have certainly
declared encoding in the source file which contains the implementation
of this function (which contains a literal "å"), but come to think of
it I might have forgotten to declare endcoding of the source file
which is actually running when it crashes?

Joakim


On 4 Mar, 08:48, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Mar 4, 6:45 am, Joakim Hove <joakim.h...@gmail.com> wrote:
>
> > About every once a year I am forced out on the internet to read about
> > "encodings and such"; while reading about it all makes sense, but when
> > actually trying to get things to work I always go through a period of
> > swearing and frustration - I never really get it :-(
>
> > Now, in a Django view I have a selectionlist, and one of the seletions
> > should contain the Norwegian problem child 'å'. I have tried the
> > following:
>
> > 1, I have explicitly used the HTML syntax &aring; - however in this
> > case Django ended up rendering the '&' as '&amp;', i.e. as if I wanted
> > a literal '&'.
>
> Nothing to do with encodings, this is autoescaping at work. 
> Seehttp://docs.djangoproject.com/en/1.1/topics/templates/#id2
>
> > 2. I just entered the 'å' in the Python source code for the view. Then
> > a get a Python run.-time error stating that I must declare an encoding
> > when using non-ASCII characters. I then tried declaring the encoding
> > 'latin-1' in the top of the source file of the view, this gave a
> > UnicodeDecodeError triggered by Django:
>
> >         'ascii' codec can't decode byte 0xe5 in position 14: ordinal
> > not in range(128)
>
> > Any hints?
>
> Please show the code.
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to