On Mar 29, 2011, at 6:53 AM, Jim Karsten wrote:
>
> I have a variable named 'reg_no' that when used as a link paramater is
> getting converted into a registered trademark symbol. Here is a simple
> example that illustrates it.
>
> The controller:
>
> def page():
> link = A('my link', _href=URL(r=request, vars=request.vars))
> form = SQLFORM.factory(
> Field('input_one', default=request.vars.input_one),
> Field('reg_no', default=request.vars.reg_no),
> )
> return dict(form=form, link=link)
>
> The view:
>
> {{=form}}
> {{=link}}
>
>
> Enter values in both fields, then submit. Then click the link. The
> link should refresh the page, with the form populated with the entered
> values. If the second field is named 'input_two' it works. But when
> it's named 'reg_no' the first input has 'aaaR_no=bbb' where 'aaa' and
> 'bbb' are the entered values and R is the registered trademark symbol,
> and the second input is blank.
>
> The link url is very different depending on the field name:
>
> 'input_two': http://www...com/demo/default/page?input_one=aaa&input_two=bbb
> 'reg_no' : http://www...com/demo/default/page?input_one=aaa%C2%AE_no%3Dbbb
>
> I renamed 'reg_no' to something not starting with 'reg_' and I have it
> working. I'm not sure if this is a bug or not.
>
> Any insight would be welcome.
The problem is that you're generating a URL of the form
http://...page?something®...somethingelse, and ® is being interpreted as
the html entity ®, the registered-copyright symbol.
I'd assume that this is a bug of some sort, that the & separator for the query
string shouldn't be participating in any URL-encode operation. But where the
bug is, I don't know. For now, I'd avoid var names that collide with html
entities.
>
> Jim Karsten