Re: [WebDNA] Convertchars Weirdness

This WebDNA talk-list message is from

2014


It keeps the original formatting.
numero = 111331
interpreted = N
texte = --Apple-Mail=_5F79E379-5460-430A-AFC0-1C789E9A7F1C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Great stuff Brian! This msg is a keeper for sure. Thanks for taking the = time to analyze and share. (And now that I think about it, I did know that convertchars could sub a = word in place of a character. doh.) Terry On Apr 25, 2014, at 1:01 PM, Brian Fries wrote: > There=92s a bit more to the issue here than just switching to = convertwords, and I think it=92s worth looking at deeper=85 >=20 > 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. >=20 > convertchars does two relevant things differently than convertwords: >=20 > 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 space >=20 > 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://example.com/thispage.dna?user+name=3DJane+Doe=94 gets a = formvariable named =93user name=94 with a value of =93Jane Doe=94. >=20 >=20 > To illustrate convertchars vs. convertwords, I spent way too much time = working out these examples... >=20 > =97=97 >=20 > Example 1: >=20 > [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]
>=20 > Results: > CHARS: L John & Joanna + Jane > WORDS: L John %26 Joanna + Jane >=20 > Notes: > The & was replaced in both cases, but for convertchars it was replaced = with & instead of literally %26 >=20 > =97=97 >=20 > Example 2: >=20 > [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]
>=20 > Results: > CHARS: L John %26 Joanna + Jane > WORDS: L John & Joanna + Jane >=20 > 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 >=20 > =97=97 >=20 > Example 3: >=20 > [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]
>=20 > Results: > CHARS: L%2BJohn%2B&%2BJoanna%2B+%2BJane > WORDS: L John & Joanna %252B Jane >=20 > 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" >=20 > =97=97 >=20 > Example 4: >=20 > [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]
>=20 > Results: > CHARS: L John & Joanna %2B Jane > WORDS: L John & Joanna + Jane >=20 > 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 >=20 > =97=97 >=20 > Example 5: >=20 > [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]
>=20 > Results: > CHARS: L+John+&+Joanna+++Jane > WORDS: L John %26 Joanna %2B Jane >=20 > 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 >=20 > =97=97 >=20 > Example 6: >=20 > [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]
>=20 > Results: > CHARS: L John %26 Joanna %2B Jane > WORDS: L John %2526 Joanna + Jane >=20 > 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 >=20 > =97=97 >=20 > Example 7: >=20 > [grep search=3D[url]%20[/url]&replace=3D ][url]L John & Joanna + = Jane[/url][/grep] >=20 > Results: > L John %26 Joanna %2B Jane >=20 > 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. >=20 >=20 > - Brian Fries >=20 >=20 > On Apr 25, 2014, at 12:25 PM, Terry Wilson wrote: >=20 >> 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 >=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=_5F79E379-5460-430A-AFC0-1C789E9A7F1C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 Great = stuff Brian! This msg is a keeper for sure. Thanks for taking the time = to analyze and share.

(And now that I think about it, = I did know that convertchars could sub a word in place of a character. = doh.)

Terry

On Apr 25, = 2014, at 1:01 PM, Brian Fries <iphonzie@gmail.com> = wrote:

There=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 = "htt= p://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=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"

=97=97

<= div>Example 4:

[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


On Apr 25, 2014, at = 12:25 PM, Terry Wilson <terry@terryfic.com> = wrote:

Not a = bug. Convertchars is a one to one thing. Convertwords will handle the = %27 etc. that is more than one = character.


On Apr 24, 2014, at 10:16 = AM, Michael Davis <admin@network13.net> = wrote:

Thanks = Stuart.  That works.  Am I misunderstanding the usage of = convertchars?  Or is this a known = bug?

Mike

On Apr 23, 2014, at = 2:52 PM, Stuart Tremain <webdna@idfk.com.au> = wrote:

Mike = change to = CONVERTWORDS

:)



Regards

Stuart = Tremain
IDFK Web Developments
AUSTRALIA




On 24 Apr 2014, at 2:21 am, Michael Davis = <admin@network13.net> = wrote:

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 to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/l= ist/talk@webdna.us Bug Reporting: support@webdna.us

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/l= ist/talk@webdna.us Bug Reporting: support@webdna.us

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/l= ist/talk@webdna.us Bug Reporting: support@webdna.us

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/l= ist/talk@webdna.us Bug Reporting: support@webdna.us

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/l= ist/talk@webdna.us Bug Reporting: support@webdna.us

= --Apple-Mail=_5F79E379-5460-430A-AFC0-1C789E9A7F1C-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Convertchars Weirdness (Michael Davis 2014)
  2. Re: [WebDNA] Convertchars Weirdness (Terry Wilson 2014)
  3. Re: [WebDNA] Convertchars Weirdness (Brian Fries 2014)
  4. Re: [WebDNA] Convertchars Weirdness (Terry Wilson 2014)
  5. Re: [WebDNA] Convertchars Weirdness (Stuart Tremain 2014)
  6. Re: [WebDNA] Convertchars Weirdness (Michael Davis 2014)
  7. Re: [WebDNA] Convertchars Weirdness (Stuart Tremain 2014)
  8. Re: [WebDNA] Convertchars Weirdness (Michael Davis 2014)
  9. [WebDNA] Convertchars Weirdness (Michael Davis 2014)
--Apple-Mail=_5F79E379-5460-430A-AFC0-1C789E9A7F1C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Great stuff Brian! This msg is a keeper for sure. Thanks for taking the = time to analyze and share. (And now that I think about it, I did know that convertchars could sub a = word in place of a character. doh.) Terry On Apr 25, 2014, at 1:01 PM, Brian Fries wrote: > There=92s a bit more to the issue here than just switching to = convertwords, and I think it=92s worth looking at deeper=85 >=20 > 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. >=20 > convertchars does two relevant things differently than convertwords: >=20 > 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 space >=20 > 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://example.com/thispage.dna?user+name=3DJane+Doe=94 gets a = formvariable named =93user name=94 with a value of =93Jane Doe=94. >=20 >=20 > To illustrate convertchars vs. convertwords, I spent way too much time = working out these examples... >=20 > =97=97 >=20 > Example 1: >=20 > [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]
>=20 > Results: > CHARS: L John & Joanna + Jane > WORDS: L John %26 Joanna + Jane >=20 > Notes: > The & was replaced in both cases, but for convertchars it was replaced = with & instead of literally %26 >=20 > =97=97 >=20 > Example 2: >=20 > [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]
>=20 > Results: > CHARS: L John %26 Joanna + Jane > WORDS: L John & Joanna + Jane >=20 > 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 >=20 > =97=97 >=20 > Example 3: >=20 > [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]
>=20 > Results: > CHARS: L%2BJohn%2B&%2BJoanna%2B+%2BJane > WORDS: L John & Joanna %252B Jane >=20 > 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" >=20 > =97=97 >=20 > Example 4: >=20 > [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]
>=20 > Results: > CHARS: L John & Joanna %2B Jane > WORDS: L John & Joanna + Jane >=20 > 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 >=20 > =97=97 >=20 > Example 5: >=20 > [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]
>=20 > Results: > CHARS: L+John+&+Joanna+++Jane > WORDS: L John %26 Joanna %2B Jane >=20 > 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 >=20 > =97=97 >=20 > Example 6: >=20 > [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]
>=20 > Results: > CHARS: L John %26 Joanna %2B Jane > WORDS: L John %2526 Joanna + Jane >=20 > 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 >=20 > =97=97 >=20 > Example 7: >=20 > [grep search=3D[url]%20[/url]&replace=3D ][url]L John & Joanna + = Jane[/url][/grep] >=20 > Results: > L John %26 Joanna %2B Jane >=20 > 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. >=20 >=20 > - Brian Fries >=20 >=20 > On Apr 25, 2014, at 12:25 PM, Terry Wilson wrote: >=20 >> 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 >=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=_5F79E379-5460-430A-AFC0-1C789E9A7F1C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 Great = stuff Brian! This msg is a keeper for sure. Thanks for taking the time = to analyze and share.

(And now that I think about it, = I did know that convertchars could sub a word in place of a character. = doh.)

Terry

On Apr 25, = 2014, at 1:01 PM, Brian Fries <iphonzie@gmail.com> = wrote:

There=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 = "htt= p://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=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"

=97=97

<= div>Example 4:

[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


On Apr 25, 2014, at = 12:25 PM, Terry Wilson <terry@terryfic.com> = wrote:

Not a = bug. Convertchars is a one to one thing. Convertwords will handle the = %27 etc. that is more than one = character.


On Apr 24, 2014, at 10:16 = AM, Michael Davis <admin@network13.net> = wrote:

Thanks = Stuart.  That works.  Am I misunderstanding the usage of = convertchars?  Or is this a known = bug?

Mike

On Apr 23, 2014, at = 2:52 PM, Stuart Tremain <webdna@idfk.com.au> = wrote:

Mike = change to = CONVERTWORDS

:)



Regards

Stuart = Tremain
IDFK Web Developments
AUSTRALIA




On 24 Apr 2014, at 2:21 am, Michael Davis = <admin@network13.net> = wrote:

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 to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/l= ist/talk@webdna.us Bug Reporting: support@webdna.us

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/l= ist/talk@webdna.us Bug Reporting: support@webdna.us

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/l= ist/talk@webdna.us Bug Reporting: support@webdna.us

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/l= ist/talk@webdna.us Bug Reporting: support@webdna.us

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/l= ist/talk@webdna.us Bug Reporting: support@webdna.us

= --Apple-Mail=_5F79E379-5460-430A-AFC0-1C789E9A7F1C-- Terry Wilson

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:

mac hack (1997) FEATURE REQUEST: (was: Summarizing results. Is there a (1999) SQL in SEARCH breaks FOUNDITEMS (1999) Sorting Orders (1997) FAX orders (1996) Browser Problem?!? Still getting Error message usingPOST! (1997) autosensing lanague selection (1997) Text data with spaces in them... (1997) WebCat2b13MacPlugIn - [include] doesn't allow creator (1997) OFF LIST... Template Cache problem -- new plugin for ya' (2000) Problem (1997) Emailer choke (1997) Members register & gain access system (1998) Press Release hit the NewsWire!!! (1997) PCS Emailer's role ? (1997) Simple way to create unique SKU (1997) apostrophe in search item (1997) How many Databases can I open? (2003) webcat/chat/javascript/IE on windows only problem - long,code included - nevermind (2002) [urgent] Phone number at SM (2006)