[sclug] URL encoding/decoding question

pieter claassen pieter at claassen.co.uk
Mon Feb 20 12:27:31 UTC 2006


On Sun, 2006-02-19 at 20:07 +0000, Roland Turner (SCLUG) wrote:


> It occurs to me that, perhaps the reason Pieter is getting the
> "incomplete escape" message is that he's double-decoding:
> 
> "+%25+" -> " % "
> " % " -> ERROR
> 
> Pieter?

The database issues are sorted out. Yes, I am definitely using
parameterised queries (Jon don't laugh, that was two months ago!).

I don't need URL encoding in this case as I was stupidly passing large
volumes of data through the browser when there was no need for it. The
problem wasn't double decoding though it was a good thought.

The problem was (and still is, even though database mangling and
URLEncoding/decoding mangling has been eliminated) that if I edit some
text in a <textarea> that contains HTML (specifically encoded HTML) then
it promptly decodes it as HTML and renders it in the textarea and then
encodes the submissions into something more evil.

So, when I place € in my text area and submits, it ends up as
€ in the db but is rendered as ? in the textarea the second time
round.

If I submit ? the second time round, it is stored as ? in the db and
rendered as ???.

The browser interprets € &#x20AC; and € in the <TEXTAREA>

The field in the db is a TEXT field.

I strikes me that if there was a way to inform text areas that the
content they contain is NOT HTML and therefore should not be rendered as
such, then the problem might go away. BTW. This is Firefox 1.0.7.

Thanks for the comments so far.

Cheers,
Pieter

P.S. I am not writing a web HTML editor, just want to edit some text
that might and do contain HTML sometimes.



More information about the Sclug mailing list