Re: [WebDNA] Convertchars Weirdness

This WebDNA talk-list message is from

2014


It keeps the original formatting.
numero = 111330
interpreted = N
texte = --Apple-Mail=_E4A8627E-34D4-4B92-97CE-CC28238D0200 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 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 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 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. To illustrate convertchars vs. convertwords, I spent way too much time = working out these examples... =97=97 Example 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 + 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]
WORDS: [convertwords table=3Dt1]L John & Joanna + = Jane[/convertwords]
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 Example 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+%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 Example 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 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]
WORDS: [convertwords table=3Dt1]L John & Joanna + = Jane[/convertwords]
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 Example 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 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 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-CC28238D0200 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 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 = "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"

=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

= --Apple-Mail=_E4A8627E-34D4-4B92-97CE-CC28238D0200-- 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=_E4A8627E-34D4-4B92-97CE-CC28238D0200 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 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 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 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. To illustrate convertchars vs. convertwords, I spent way too much time = working out these examples... =97=97 Example 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 + 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]
WORDS: [convertwords table=3Dt1]L John & Joanna + = Jane[/convertwords]
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 Example 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+%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 Example 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 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]
WORDS: [convertwords table=3Dt1]L John & Joanna + = Jane[/convertwords]
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 Example 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 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 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-CC28238D0200 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 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 = "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"

=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

= --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:

Appending space (1998) [append] - illegal characters? (2000) [WebDNA] Candidate versions release (2010) Includeform Error (2002) WebCatalog f2 Installation (1997) multiple credit card merchant accounts/processors (1997) Automating a Post Method (2000) [returnraw] and form variables (1998) Country & Ship-to address & other fields ? (1997) Showing unopened cart (1997) b12 cannot limit records returned and more. (1997) back one? (2000) Postdata expired from cache (2004) writefiles (1999) summ=T (2003) [OT] Industry standard for missing orders (2003) Search (1997) WebCat2final1 crashes (1997) different show next (1997) transferring values (1998)