1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SafeChars: Escaped version of @unsafe

Discussion in 'Plugins' started by thedave, Jun 28, 2014.

  1. thedave

    Joined:
    Nov 13, 2008
    Messages:
    254
    Likes Received:
    2
    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?
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,286
    Likes Received:
    39
    Maybe.... I'll play with in Monday.
     
  3. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,286
    Likes Received:
    39
    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....
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    I think by "strong quote" you mean "backtick". Right guess?
     
  5. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,286
    Likes Received:
    39
    Yes. (Or maybe it's a grave accent. Or a backspark, or whatever you call ASCII 96.)
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,286
    Likes Received:
    39
  7. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    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.
     
  8. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,286
    Likes Received:
    39
    Have you looked at FixNames?
     

Share This Page