The & was replaced in both =cases, but for convertchars it was replaced with & instead of =literally =%26
Example =2:
[table =name=3Dt1&fields=3Dfrom,to]
%26=%2526
[/table]
CHARS: [convertchars =table=3Dt1]L John & Joanna + =Jane[/convertchars]<br>
WORDS: [convertwords table=3Dt1]L =John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L John %26 Joanna + Jane
WORDS: L John & Joanna + =Jane
Notes:
convertchars treats the =93to=94 =value of =93%26=94 as the character =93&=94, and the =93from=94 =value of =93%2526=94 as =93%26=94 (after unurling %25 to =%)
convertwords treated =93%26=94 literally as =93%26=94, so =it did not find and replace the & =character
=97=97
E=xample 3:
[table =name=3Dt1&fields=3Dfrom,to]
+=%252B
[/table]
CHARS: [convertchars =table=3Dt1]L John & Joanna + =Jane[/convertchars]<br>
WORDS: [convertwords table=3Dt1]L =John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L%2BJohn%2B&%2BJoanna%2B+%2BJane
WORDS: L John & =Joanna %252B Jane
Notes:
convertchars treats =the =93to=94 value of =93+=94 as the SPACE character, so all spaces were =replaced with %2526, unurled to %2B, and the =93+=94 character was not =replaced
convertwords treated the to and from as entered, =replacing =93+=94 with, literally, ==93%2526"
[table =name=3Dt1&fields=3Dfrom,to]
%2B=%252B
[/table]
CHARS: [convertchars =table=3Dt1]L John & Joanna + =Jane[/convertchars]<br>
WORDS: [convertwords table=3Dt1]L =John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L John & Joanna %2B Jane
WORDS: L John & Joanna =+ Jane
Notes:
convertchars treats the =93to=94= value of =93%2B=94 as the =93+" character, so =93+" was replaced with =%2526, unurled to %2B, and spaces were not =replaced
convertwords found no literal =93%2B=94 strings to =replace
=97=97
Example 5:
[table =name=3Dt1&fields=3Dfrom,to]
'%27
+=%2B
#=%23
%=%25
&%26
!=%21
"=%22
[/table]
CHARS: [convertchars =table=3Dt1]L John & Joanna + =Jane[/convertchars]<br>
WORDS: [convertwords table=3Dt1]L =John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L+John+&+Joanna+++Jane
WORDS: L John %26 Joanna %2B =Jane
Notes:
This is Michael's original =example (with =93 + Jane=94 added to the source =string).
convertchars treats the =93to=94 value of =93+=94 =as the SPACE character, so:
all spaces were replaced with =%2B, unurled to =93+=94
the =93&=94 character was =replaced with %26, unurled back to the =93&=94 =character
the =93+=94 character was not =replaced
convertwords treated the to and from as entered, =so:
=spaces were not changed
the =93&=94 character was =replaced with %26
the "+=94 character was replaced =with %2B
So, in this case, the results of convertwords =represent the desired =outcome
=97=97
Exa=mple 6:
[table =name=3Dt1&fields=3Dfrom,to]
=91%2527
%2B=%252B
#%2523
%%2525
&=%2526
!%2521
=93=%2522
[/table]
CHARS: [convertchars =table=3Dt1]L John & Joanna + =Jane[/convertchars]<br>
WORDS: [convertwords table=3Dt1]L =John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L John %26 Joanna %2B Jane
WORDS: L John =%2526 Joanna + Jane
Notes:
=46rom =example 5, the =93+=94 from value was replaced with =93%2B" and the from ==93%=94 characters were replaced with =93%25"
convertchars =treats the =93to=94 value of =93%2B=94 as the =93+" character, =so:
all spaces were left alone
the ==93&=94 character was replaced with the desired =93%26", after =unurling =93%25" to =93%"
the =93+=94 character was =replaced with the desired =93%2B"
convertwords treated the to =and from as entered, so:
spaces were not =changed
the =93&=94 character was replaced with %2526 (not =the desired %26)
the "+=94 character was not =replaced
So, in this case, the results of convertchars =represent the desired =outcome
=97=97
Example 7:
[grep =search=3D[url]%20[/url]&replace=3D ][url]L John & Joanna + =Jane[/url][/grep]
Results:
L John %26 =Joanna %2B Jane
Notes:
I=92m not sure =of the specifics of the desired mapping beyond what is shown, but if it =is to URL everything except space characters, as it appears, then using =the built in URL then reverting %20 to the space character does the =trick in one line.
- Brian =Fries
Not a =bug. Convertchars is a one to one thing. Convertwords will handle the =%27 etc. that is more than one =character.
Thanks =Stuart. That works. Am I misunderstanding the usage of =convertchars? Or is this a known =bug?
Mike
Mike =change to =CONVERTWORDS
:)
Regards
Stuart =Tremain
IDFK Web Developments
AUSTRALIA
Hello,
I=92m getting unexpected behavior =from convertchars:
<html>
<body>
[table =name=3Dt1&fields=3Dfrom,to]
'%27
+=%2B
#%23
%=%25
&%26
!=%21
"=%22
[/table]
[convertchars table=3Dt1]L John =& =Joanna[/convertchars]
</body>
</html>
This is spitting =out:
L+John+&+Joanna
What might I be missing or doing wrong =here?
Thanks,
Mike
---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/l=ist/talk@webdna.usBug Reporting: support@webdna.us
---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/l=ist/talk@webdna.usBug Reporting: support@webdna.us
---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/l=ist/talk@webdna.usBug Reporting: support@webdna.us
---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/l=ist/talk@webdna.usBug Reporting: support@webdna.us
=--Apple-Mail=_E4A8627E-34D4-4B92-97CE-CC28238D0200--
Associated Messages, from the most recent to the oldest:
--Apple-Mail=_E4A8627E-34D4-4B92-97CE-CC28238D0200Content-Transfer-Encoding: quoted-printableContent-Type: text/plain;charset=windows-1252There=92s a bit more to the issue here than just switching to =convertwords, and I think it=92s worth looking at deeper=85In this specific case, convertwords happens to work, but convertchars is =actually perfectly fine with replacing one character with multiple =characters. If you want to replace a multiple character string with one =or more other characters, then convertwords is the tool of choice.convertchars does two relevant things differently than convertwords:1) convertchars automatically UNURLs the TO and FROM fields in the =table, so =93%26" is treated as an =93&=94 character rather than the =literal =93%26"2) convertchars treats a =93+=94 in the =93to=94 field like a spaceThere are reasons for these differences. The UNURLing of TO and FROM =allows specification of invisible characters that you may need to strip =out of or add to a data source. The + to SPACE mapping is a bit more =esoteric, but I would bet the internal WebDNA program uses (or maybe ==93used") the same block of code for interpreting query parameters in a =URL - the stuff after the ? - where spaces are mapped to + characters by =the browser. For example ="http://example.com/thispage.dna?user+name=3DJane+Doe=94 gets a =formvariable named =93user name=94 with a value of =93Jane Doe=94.To illustrate convertchars vs. convertwords, I spent way too much time =working out these examples...=97=97Example 1:[table name=3Dt1&fields=3Dfrom,to]&%26[/table]CHARS: [convertchars table=3Dt1]L John & Joanna + =Jane[/convertchars]
WORDS: [convertwords table=3Dt1]L John & Joanna + =Jane[/convertwords]
Results:CHARS: L John & Joanna + JaneWORDS: L John %26 Joanna + JaneNotes:The & was replaced in both cases, but for convertchars it was replaced =with & instead of literally %26=97=97Example 2:[table name=3Dt1&fields=3Dfrom,to]%26%2526[/table]CHARS: [convertchars table=3Dt1]L John & Joanna + =Jane[/convertchars]
WORDS: [convertwords table=3Dt1]L John & Joanna + =Jane[/convertwords]
Results:CHARS: L John %26 Joanna + JaneWORDS: L John & Joanna + JaneNotes:convertchars treats the =93to=94 value of =93%26=94 as the character ==93&=94, and the =93from=94 value of =93%2526=94 as =93%26=94 (after =unurling %25 to %)convertwords treated =93%26=94 literally as =93%26=94, so it did not =find and replace the & character=97=97Example 3:[table name=3Dt1&fields=3Dfrom,to]+%252B[/table]CHARS: [convertchars table=3Dt1]L John & Joanna + =Jane[/convertchars]
WORDS: [convertwords table=3Dt1]L John & Joanna + =Jane[/convertwords]
Results:CHARS: L%2BJohn%2B&%2BJoanna%2B+%2BJaneWORDS: L John & Joanna %252B JaneNotes:convertchars treats the =93to=94 value of =93+=94 as the SPACE =character, so all spaces were replaced with %2526, unurled to %2B, and =the =93+=94 character was not replacedconvertwords treated the to and from as entered, replacing =93+=94 with, =literally, =93%2526"=97=97Example 4:[table name=3Dt1&fields=3Dfrom,to]%2B%252B[/table]CHARS: [convertchars table=3Dt1]L John & Joanna + =Jane[/convertchars]
WORDS: [convertwords table=3Dt1]L John & Joanna + =Jane[/convertwords]
Results:CHARS: L John & Joanna %2B JaneWORDS: L John & Joanna + JaneNotes:convertchars treats the =93to=94 value of =93%2B=94 as the =93+" =character, so =93+" was replaced with %2526, unurled to %2B, and spaces =were not replacedconvertwords found no literal =93%2B=94 strings to replace=97=97Example 5:[table name=3Dt1&fields=3Dfrom,to]'%27+%2B#%23%%25&%26!%21"%22[/table]CHARS: [convertchars table=3Dt1]L John & Joanna + =Jane[/convertchars]
WORDS: [convertwords table=3Dt1]L John & Joanna + =Jane[/convertwords]
Results:CHARS: L+John+&+Joanna+++JaneWORDS: L John %26 Joanna %2B JaneNotes:This is Michael's original example (with =93 + Jane=94 added to the =source string).convertchars treats the =93to=94 value of =93+=94 as the SPACE =character, so:all spaces were replaced with %2B, unurled to =93+=94the =93&=94 character was replaced with %26, unurled back to the ==93&=94 characterthe =93+=94 character was not replacedconvertwords treated the to and from as entered, so:spaces were not changedthe =93&=94 character was replaced with %26the "+=94 character was replaced with %2BSo, in this case, the results of convertwords represent the desired =outcome=97=97Example 6:[table name=3Dt1&fields=3Dfrom,to]=91%2527%2B%252B#%2523%%2525&%2526!%2521=93%2522[/table]CHARS: [convertchars table=3Dt1]L John & Joanna + =Jane[/convertchars]
WORDS: [convertwords table=3Dt1]L John & Joanna + =Jane[/convertwords]
Results:CHARS: L John %26 Joanna %2B JaneWORDS: L John %2526 Joanna + JaneNotes:=46rom example 5, the =93+=94 from value was replaced with =93%2B" and =the from =93%=94 characters were replaced with =93%25"convertchars treats the =93to=94 value of =93%2B=94 as the =93+" =character, so:all spaces were left alonethe =93&=94 character was replaced with the desired =93%26", =after unurling =93%25" to =93%"the =93+=94 character was replaced with the desired =93%2B"convertwords treated the to and from as entered, so:spaces were not changedthe =93&=94 character was replaced with %2526 (not the desired =%26)the "+=94 character was not replacedSo, in this case, the results of convertchars represent the desired =outcome=97=97Example 7:[grep search=3D
[url]%20[/url]&replace=3D ]
[url]L John & Joanna + =Jane[/url][/grep]Results:L John %26 Joanna %2B JaneNotes:I=92m not sure of the specifics of the desired mapping beyond what is =shown, but if it is to URL everything except space characters, as it =appears, then using the built in URL then reverting %20 to the space =character does the trick in one line.- Brian FriesOn Apr 25, 2014, at 12:25 PM, Terry Wilson
wrote:> Not a bug. Convertchars is a one to one thing. Convertwords will =handle the %27 etc. that is more than one character.>=20>=20> On Apr 24, 2014, at 10:16 AM, Michael Davis =wrote:>=20>> Thanks Stuart. That works. Am I misunderstanding the usage of =convertchars? Or is this a known bug?>>=20>> Mike>>=20>> On Apr 23, 2014, at 2:52 PM, Stuart Tremain =wrote:>>=20>>> Mike change to CONVERTWORDS>>>=20>>> :)>>>=20>>>=20>>>=20>>> Regards>>>=20>>> Stuart Tremain>>> IDFK Web Developments>>> AUSTRALIA>>> webdna@idfk.com.au>>>=20>>>=20>>>=20>>>=20>>> On 24 Apr 2014, at 2:21 am, Michael Davis =wrote:>>>=20>>>> Hello,>>>> I=92m getting unexpected behavior from convertchars:>>>>=20>>>> >>>> >>>> [table name=3Dt1&fields=3Dfrom,to]>>>> '%27>>>> +%2B>>>> #%23>>>> %%25>>>> &%26>>>> !%21>>>> "%22>>>> [/table]>>>> [convertchars table=3Dt1]L John & Joanna[/convertchars]>>>> >>>> >>>>=20>>>> This is spitting out:>>>>=20>>>> L+John+&+Joanna>>>>=20>>>> What might I be missing or doing wrong here?>>>>=20>>>> Thanks,>>>> Mike>>>>=20>>>> --------------------------------------------------------- This =message is sent to you because you are subscribed to the mailing list . =To unsubscribe, E-mail to: archives: =http://mail.webdna.us/list/talk@webdna.us Bug Reporting: =support@webdna.us>>>=20>>> --------------------------------------------------------- This =message is sent to you because you are subscribed to the mailing list . =To unsubscribe, E-mail to: archives: =http://mail.webdna.us/list/talk@webdna.us Bug Reporting: =support@webdna.us>>=20>> --------------------------------------------------------- This =message is sent to you because you are subscribed to the mailing list . =To unsubscribe, E-mail to: archives: =http://mail.webdna.us/list/talk@webdna.us Bug Reporting: =support@webdna.us>=20> --------------------------------------------------------- This message =is sent to you because you are subscribed to the mailing list . To =unsubscribe, E-mail to: archives: =http://mail.webdna.us/list/talk@webdna.us Bug Reporting: =support@webdna.us--Apple-Mail=_E4A8627E-34D4-4B92-97CE-CC28238D0200Content-Transfer-Encoding: quoted-printableContent-Type: text/html;charset=windows-1252There=92s a bit more to the =issue here than just switching to convertwords, and I think it=92s worth =looking at deeper=85
In this specific case, =convertwords happens to work, but convertchars is actually perfectly =fine with replacing one character with multiple characters. If you want =to replace a multiple character string with one or more other =characters, then convertwords is the tool of =choice.
convertchars does two relevant things =differently than =convertwords:
1) convertchars automatic=ally UNURLs the TO and FROM fields in the table, so =93%26" is treated =as an =93&=94 character rather than the literal ==93%26"
2) convertchars treats a =93+=94 in the =93to=94= field like a space
There are reasons for these =differences. The UNURLing of TO and FROM allows specification of =invisible characters that you may need to strip out of or add to a data =source. The + to SPACE mapping is a bit more esoteric, but I would bet =the internal WebDNA program uses (or maybe =93used") the same block of =code for interpreting query parameters in a URL - the stuff after the ? =- where spaces are mapped to + characters by the browser. For example ="
http://ex=ample.com/thispage.dna?user+name=3DJane+Doe=94 gets a formvariable =named =93user name=94 with a value of =93Jane =Doe=94.
To illustrate =convertchars vs. convertwords, I spent way too much time working out =these =examples...
=97=97
Examp=le 1:
[table =name=3Dt1&fields=3Dfrom,to]
&=%26
[/table]
CHARS: [convertchars table=3Dt1]L =John & Joanna + Jane[/convertchars]<br>
WORDS: =[convertwords table=3Dt1]L John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L John & Joanna + Jane
WORDS: L John %26 Joanna + =Jane
Notes:
The & was replaced in both =cases, but for convertchars it was replaced with & instead of =literally =%26
=97=97
Example =2:
[table =name=3Dt1&fields=3Dfrom,to]
%26=%2526
[/table]
CHARS: [convertchars =table=3Dt1]L John & Joanna + =Jane[/convertchars]<br>
WORDS: [convertwords table=3Dt1]L =John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L John %26 Joanna + Jane
WORDS: L John & Joanna + =Jane
Notes:
convertchars treats the =93to=94 =value of =93%26=94 as the character =93&=94, and the =93from=94 =value of =93%2526=94 as =93%26=94 (after unurling %25 to =%)
convertwords treated =93%26=94 literally as =93%26=94, so =it did not find and replace the & =character
=97=97
E=xample 3:
[table =name=3Dt1&fields=3Dfrom,to]
+=%252B
[/table]
CHARS: [convertchars =table=3Dt1]L John & Joanna + =Jane[/convertchars]<br>
WORDS: [convertwords table=3Dt1]L =John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L%2BJohn%2B&%2BJoanna%2B+%2BJane
WORDS: L John & =Joanna %252B Jane
Notes:
convertchars treats =the =93to=94 value of =93+=94 as the SPACE character, so all spaces were =replaced with %2526, unurled to %2B, and the =93+=94 character was not =replaced
convertwords treated the to and from as entered, =replacing =93+=94 with, literally, ==93%2526"
[table =name=3Dt1&fields=3Dfrom,to]
%2B=%252B
[/table]
CHARS: [convertchars =table=3Dt1]L John & Joanna + =Jane[/convertchars]<br>
WORDS: [convertwords table=3Dt1]L =John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L John & Joanna %2B Jane
WORDS: L John & Joanna =+ Jane
Notes:
convertchars treats the =93to=94= value of =93%2B=94 as the =93+" character, so =93+" was replaced with =%2526, unurled to %2B, and spaces were not =replaced
convertwords found no literal =93%2B=94 strings to =replace
=97=97
Example 5:
[table =name=3Dt1&fields=3Dfrom,to]
'%27
+=%2B
#=%23
%=%25
&%26
!=%21
"=%22
[/table]
CHARS: [convertchars =table=3Dt1]L John & Joanna + =Jane[/convertchars]<br>
WORDS: [convertwords table=3Dt1]L =John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L+John+&+Joanna+++Jane
WORDS: L John %26 Joanna %2B =Jane
Notes:
This is Michael's original =example (with =93 + Jane=94 added to the source =string).
convertchars treats the =93to=94 value of =93+=94 =as the SPACE character, so:
all spaces were replaced with =%2B, unurled to =93+=94
the =93&=94 character was =replaced with %26, unurled back to the =93&=94 =character
the =93+=94 character was not =replaced
convertwords treated the to and from as entered, =so:
=spaces were not changed
the =93&=94 character was =replaced with %26
the "+=94 character was replaced =with %2B
So, in this case, the results of convertwords =represent the desired =outcome
=97=97
Exa=mple 6:
[table =name=3Dt1&fields=3Dfrom,to]
=91%2527
%2B=%252B
#%2523
%%2525
&=%2526
!%2521
=93=%2522
[/table]
CHARS: [convertchars =table=3Dt1]L John & Joanna + =Jane[/convertchars]<br>
WORDS: [convertwords table=3Dt1]L =John & Joanna + =Jane[/convertwords]<br>
Results:
CHARS: L John %26 Joanna %2B Jane
WORDS: L John =%2526 Joanna + Jane
Notes:
=46rom =example 5, the =93+=94 from value was replaced with =93%2B" and the from ==93%=94 characters were replaced with =93%25"
convertchars =treats the =93to=94 value of =93%2B=94 as the =93+" character, =so:
all spaces were left alone
the ==93&=94 character was replaced with the desired =93%26", after =unurling =93%25" to =93%"
the =93+=94 character was =replaced with the desired =93%2B"
convertwords treated the to =and from as entered, so:
spaces were not =changed
the =93&=94 character was replaced with %2526 (not =the desired %26)
the "+=94 character was not =replaced
So, in this case, the results of convertchars =represent the desired =outcome
=97=97
Example 7:
[grep =search=3D
[url]%20[/url]&replace=3D ]
[url]L John & Joanna + =Jane[/url][/grep]
Results:
L John %26 =Joanna %2B Jane
Notes:
I=92m not sure =of the specifics of the desired mapping beyond what is shown, but if it =is to URL everything except space characters, as it appears, then using =the built in URL then reverting %20 to the space character does the =trick in one line.
- Brian =Fries
Not a =bug. Convertchars is a one to one thing. Convertwords will handle the =%27 etc. that is more than one =character.
Thanks =Stuart. That works. Am I misunderstanding the usage of =convertchars? Or is this a known =bug?
Mike
Mike =change to =CONVERTWORDS
:)
Regards
Stuart =Tremain
IDFK Web Developments
AUSTRALIA
Hello,
I=92m getting unexpected behavior =from convertchars:
<html>
<body>
[table =name=3Dt1&fields=3Dfrom,to]
'%27
+=%2B
#%23
%=%25
&%26
!=%21
"=%22
[/table]
[convertchars table=3Dt1]L John =& =Joanna[/convertchars]
</body>
</html>
This is spitting =out:
L+John+&+Joanna
What might I be missing or doing wrong =here?
Thanks,
Mike
---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/l=ist/talk@webdna.usBug Reporting: support@webdna.us
---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/l=ist/talk@webdna.usBug Reporting: support@webdna.us
---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/l=ist/talk@webdna.usBug Reporting: support@webdna.us
---------------------------------------------------------This message is sent to you because you are subscribed tothe mailing list .To unsubscribe, E-mail to: archives: http://mail.webdna.us/l=ist/talk@webdna.usBug Reporting: support@webdna.us
=--Apple-Mail=_E4A8627E-34D4-4B92-97CE-CC28238D0200--
Brian Fries
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Error 11 (1996)
WebMerchant 2.1.2 (1998)
MasterCounter - Does this work?? (1999)
Showif, Hideif reverse logic ? (1997)
WebCat B13 Mac CGI -- Frames question (1997)
encryption (2003)
Bug Report, maybe (1997)
Upgrading old WebCat Database Files (1997)
WebCat2.0 [format thousands .0f] no go (1997)
Protect vs Authenicate (1997)
webcat & permissions (1999)
autocommit problem (1998)
Error Messages Returned to User (1997)
UPS Online (2002)
WebCat2 Append problem (B14Macacgi) (1997)
High ASCII inside [LOOKUP] inside [LISTWORDS] (1998)
New public beta available (1997)
lookup command (1999)
Multiple instances of database (2003)
WebCat2 several catalogs? (1997)