[pmwiki-users] Squishing every bug in site!

The Editor editor at fast.st
Wed Sep 20 18:10:08 CDT 2006


TWO QUESTIONS:  SINGLE QUOTES AND LINE BREAKS

I was able to fix the double quote bug but seem to have created a new
one.  Now I'm having problems with single quotes.  Squish squish
squish.

Basically I have a textarea field.  That info is saved onto a datapage
(and later parsed based on this pattern) as

field="value"

To solve the " problem I changed all the double quotes to "
before saving.

In another part of the recipe, these values are retrieved as page
variables.  I fixed the following line to set the page variables using
Americo's great suggestion:

	$FmtPV["$$v[0]"] = "'" . $v[1] . "'";

Because it is set off by single quotes, double quotes are fine.  So I
replace all the " back to " just before setting them as page
variables.

But now the single quotes, which save fine (I checked) cannot be set
as page variables properly.  So I decided to encode them also, to
' when saving the values--and did not decode them before setting
them as page variables.  Fine, but in a textarea, now every ' appears
as '.  Anywhere else, it looks fine.  Just not in a textbox which
shows the actual text content...

So I came up with a clever (?) solution.  I changed all the
apostrophes to a backtic ' -> `.  Not perfect, but hey I don`t think
its a bad solution.  Anyone have a better idea...

I tried using %27 in various ways but it shows up in the textarea also.

While I'm at this I'm trying to fix line breaks.  The returns in a
textarea are all promptly converted to %0a by PmWiki somewhere along
the way (WritePage?) and then are just as promptly ignored in the
display making all the lines run together.

Somehow though, in the textarea, all the original line breaks are
preserved.  My question here is, how can I preserve them in the
display, when {$field} is not set in a textarea?  I already have my
encoding and decoding arrays set up but not sure what to do with them.
 Any thoughts?

Cheers,
Caveman

Though it's a last resort, it might be possible to set up two
different ways to retrieve the page variable with some kind of flag
for when they are displayed in textarea, or better yet, building it
into the keep markup somehow which is used by the textarea markup so
it returns it one way for textareas...  Hmmm.




More information about the pmwiki-users mailing list