Bug: Form values are incorrectly encoded
In Form values, certain text must be encoded to not break surrounding structures. (In cairo, theses are
\n and
", dakar adds
%). Due to the encoding chosen, if one puts the encoded value of certain text in, incorrect values are returned.
Test case
In a text field of a form,
- enter
%_Q_%, and it will end up returning " in view (and next edit); in Dakar this will be %_P_"_P_%.
- enter
%_N_%, and it will disappear
Environment
--
SamHasler,
ThomasWeigert - 12 May 2005
Follow up
If we just used a standard encoding, such as
HTML entities, this would not happen.
--
CrawfordCurrie - 12 May 2005
I was thinking that also, but don't know how to invoke the browser to do it. I did not want to recode all the
HTML encoding mechanism. Remember that the
HTML encoding usually is only during the transport.
--
ThomasWeigert - 12 May 2005
You can just call
TWiki::entityEncode(), and decodue using
TWiki::entityDecode().
But that isn't the full solution. As
PeterThoeny pointed out when I suggested this before, there is still the problem that to maintain compatibility you have to decode topics that still use the old encoding, and it is that decoding step that is the cause of the errors.
--
CrawfordCurrie - 13 May 2005
Fix record
Discussion
This problem is due to the symmetrical nature of the encoding. If we were to use, for example,
%_Q_$ to encode
", and similar for the other values, this problem would not arise.
--
ThomasWeigert - 12 May 2005
OK, solved by incrementing the format number in topics to 1.1 and putting in a proper encoding (very close to the url encoding, but it encodes a different set of characters).
DevelopBranch only, of course.
SVN 4356
--
CrawfordCurrie - 06 Jun 2005