SafeChars: Escaped version of @unsafe

Nov 13, 2008
255
3
www.thedave.me
Howdy!

I've been using SafeChars but I'm trying to figure out a way to safely rename a file to it's "dangerous" (non-unicode) version. Maybe there's a better way?

@unsafe gets me close, but if the string contains double quotes, it can break out and cause carnage. I think a possible way to fix this would be an @unsafeescaped command that would change safe versions of characters to escaped unsafe characters.

So for example, "echo %@unsafeescaped[This %_AMP That]" would return "This %=& That" (with a normal/dangerous ampersand that has been neutered with a %=)

Is there a better approach?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,201
72
Albuquerque, NM
prospero.unm.edu
Or perhaps one that returned the unsafe string between strong quotes? That way, the only character which would need further attention would be the backquote character itself....
 
Jun 2, 2008
312
1
Newton, MA
I have not quite grasped how to use this plugin.

For example, if I have a file with the name My%=20File.txt and I want to rename it to My_File.txt, how would I use safechars to do it? What if I want to define an alias or btm that will take the original file name as an argument and rename it with occurrences of %=20 changed to underscores.

Perhaps that is not what safechars is for. I do see how it can be used to process the contents of a file or the clipboard or some other readable item that was created outside of TCC and that contains problem characters.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,201
72
Albuquerque, NM
prospero.unm.edu
For example, if I have a file with the name My%=20File.txt and I want to rename it to My_File.txt, how would I use safechars to do it? What if I want to define an alias or btm that will take the original file name as an argument and rename it with occurrences of %=20 changed to underscores.
Have you looked at FixNames?