Suggestion for SafeChars plugin

May 29, 2008
571
4
Groton, CT
Charles,

Would you consider adding these two functions?

@SAFECHECK[var] returns 1 if there are any characters in the translated range within the expansion of %var%, else 0.

@UNSAFECHECK[var] returns 1 if there are any characters which WOULD BE translated to safe characters (by @SAFEENV[var], according to the current translation map) within the expansion of %var%, else 0.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Actually a single function with 4 different values would be sufficient:
0 if all characters are inherently safe;
add 1 if untranslated unsafe characters are present;
add 2 if translated unsafe characters are present.

Value 1 would mean at least one unsafe character is present, and no unsafe character is translated.
Value 2 would mean at least one unsafe character is present, and all unsafe characters are translated.
Value 3 would mean at least two unsafe characters are present, and least one not translated, and at least one that is translated.
 
May 29, 2008
571
4
Groton, CT
Or as separate functions which provide counts?
Any of the above would be nice, Charles.

But Steve, the presence of, let's say, an %_amp doesn't mean that it was translated from an unsafe ampersand, so I would reword your description with
Value 2 would mean that at least one character from the translated safe range 0xFF00-0xFF3E (is that right?) is present.
Value 3 would mean that there is at least one unsafe character present and at least one from the translated safe range (no matter how it got there).
 
May 29, 2008
571
4
Groton, CT
And -- just checking -- you want to pass the name of a variable or expression to be evaluated, a la @SAFEEXP, rather than just a string?
Yes, exactly. I was thinking of a single variable as in @SAFEENV, but an expression as in @SAFEEXP would be even more useful. (A version that would take an actual string wouldn't hurt, of course.)
 
May 29, 2008
571
4
Groton, CT
I've uploaded a new build. I haven't done much testing of the new functions, so let me know whether they work as you think they should.
Wow. The descriptions indicate exactly what I think is needed (for my usage), and they look general enough to satisfy any need. I'll be testing shortly.

(later)
Tested (in my one usage, so far). Perfect.

Sample:

> echo %@countsafe["&X%_amp"]
1
> echo %@countunsafe["&X%_amp"]
3
> echo %@len["&X%_amp"]
5

Thanks, Charles.
 
Similar threads
Thread starter Title Forum Replies Date
dcantor Suggestion and request for DBF plugin Plugins 6
M How to? Use SafeChars plugin... Plugins 2
dcantor Error in SAFECHARS plugin v 1.9.0 Plugins 2
thedave SafeChars: Escaped version of @unsafe Plugins 7
M SafeChars plugin misbehaving... Plugins 3
S How to? SafeChars.dll question Plugins 4
M Charles, I just installed the "new" SafeChars plugin, ... Plugins 5
Stefano Piccardi SafeChars thank you Plugins 2
M A problem with the SafeChars Plugin... Plugins 30
M A (presumbly pretty simple) SafeChars plugin request... Plugins 2
M A "SafeChars" plugin request... Plugins 2
S SafeChars plugin Plugins 2
Charles Dye New plugin: SafeChars Plugins 15
Joe Caverly 64-bit Plugin development using PureBasic Plugins 15
R New Plugin Plugins 0
Alpengreis elevated plugin questions Plugins 3
fpefpe utf-8 support in sdk/plugin api Plugins 4
S How to? Can @DU function in 4Utils64 plugin somehow cater for dirs with spaces? Plugins 3
vefatica Plugin access to arrays? Plugins 4
vefatica How big is a plugin's parameter buffer? Plugins 5
C @knownpath plugin Plugins 0
Charles Dye Updated OSD plugin Plugins 0
Joe Caverly C# plugin framework for JPSoft's TCC Plugins 0
dcantor Help for newest version of TEXTUTILS plugin Plugins 10
dcantor UISTUFF plugin missing help topic Plugins 12
dcantor Request for documentation for ISO8601 plugin Plugins 4
vefatica Possible with a plugin? Plugins 6
dcantor Inconsistency between textutils plugin and wrap utility Plugins 2
M (Stupid?) Problem with 64-bit 4Utils plugin... Plugins 3
H Latest ISO8601 plugin? Plugins 1
Charles Dye New plugin: QKeys Plugins 34
S Plugin to quickly locate all files hard linked together Plugins 5
S Documentation Plugin everything.dll Plugins 5
newbie How to? Multi-plugin installation errors, Re: FedUtils8 Plugins 7
vefatica Plugin -> thread -> Command() -> Ctrl-C? Plugins 20
Charles Dye A weirdoid plugin question Plugins 6
M A weird error re a plugin... Plugins 0
vefatica Plugin dilemma Plugins 2
fpefpe Documentation Plugin API/SDK Plugins 3
C Looking for Vince's old 4UTILS plugin for TCMD v8 Plugins 1
S DESKTOP plugin - anyone ? Plugins 0
C How to? a plugin to sort Outlook Express "rules" Plugins 0
M ISO Plugin: Yes, it's wonderful, but it could be yet more wonderful... Plugins 7
M The ISO plugin is wonderful, but it lacks a little something... Plugins 22
Charles Dye Beta plugin: HidePasswords Plugins 3
M ISO8601 Plugin not "reporting" errors to TCC... Plugins 4
Frank 4console plugin Plugins 4
S WAD ISO8601 Plugin Plugins 15
Joe Caverly Plugin and 64-bit TCC Plugins 3
C Problem with FixNames plugin Plugins 9

Similar threads