detox for troublesome file names

My job occasionally requires that I handle files written and named in international character sets. Sometimes that is inconvenient, not in the least because file names can cause odd behavior at the command line, or interfere with the way files are managed or opened. My worst-case scenario was a file I couldn’t save after I had edited it, because the name of the file was interfering with the application’s ability to write to disk.

Manually renaming a file is the obvious solution, or if there is more than one, a fun little tool called detox will systematically convert nonstandard characters into boring equivalents. In my case, a Japanese file name might be changed from an unreadable sequence to something like “K-U_e_R_yen_ae_yo_o.doc” — which is easier for me to open, edit and send along.

By default detox will handle mundane things like converting spaces (which sometimes annoy me) to underscores, changing unusual character sets with analogues in common keysets, and weeding out characters which otherwise interfere with life at the command line — like certain quote marks or keycodes.

One of the nice things about detox is that it is configurable to a very low level, so if you don’t like the particular conversion it picks on its own, you can adjust it slightly for different results. That also means that specific sequences and character-to-character translations are probably doable.

As it is a command line tool there’s nothing really to show for it in action. The documentation is excellent and it makes a provisions for dry-runs with the -n flag, so you can test it once or twice if you have a fear of committment. There may be other ways to circumvent this issue but as an easy one-step solution to a lesser inconvenience, I find this acceptable. πŸ˜€

9 thoughts on “detox for troublesome file names

  1. Vincent "Nootilus" Corlaix

    Hello m.K.

    First I would like to thank you for your blog and all you share with it. I’m quite still a newbie in the amazingly geek world of Linux and I only start to use and begin to understand how fun and powerful this system is, especially through the CLI. Thanks to you, I’m more and more comfident in using it that way.

    I have three questions regarding your last post and especially your screenshot for the CLI-Club :). You might have already explained this later but I should have missed it, obviously.

    1- What do you use to split the terminal this way? Is this dvtm? I’m not sure since you have something like a menu line at the bottom…

    2- I’ve already saw this and now I’m definetly curious. How do you manage to have an image in some place of your multi-terminals screen? (btw, a Scanner Darkly is definetly a great movie, as the book was terrific too)

    3- Is this the regular Nethack game? I don’t have vuemeters in mine 😦

    Okay, I hope my questions won’t bother you. If so, just remove my post. If not, let me thank you again for your great work and tutorials.

    See you later!
    .V

    Reply
    1. K.Mandla Post author

      1. The terminal is running screen with the vertical split patch installed.

      Howto: Patch and set up screen-vs

      2. That’s mplayer running against the framebuffer, and pressed into the upper-left corner of the screen. The rest of the screen is partitioned off to use the remaining space, so it’s not really running “in” the terminal, as much as it is pasting over the top of the framebuffer display.

      Quit X! screen-vs is more fun!

      3. The game is called crawl, and you can install it or play it over telnet. I usually stick with the latter, just because it’s easier than managing all the libraries and whatnot in Crux.

      A big thumbs up: Stone Soup

      Enjoy!

      Reply
  2. Pingback: Links 29/1/2010: Many New Releases of GNU/Linux, Oracle Makes Promises | Boycott Novell

  3. Stan

    Heya K-Mandla!!

    I understand that you are run (and test) your OSes on old hardware, and you are also an Arch user.

    Might I point you over to a particular experiment several CrunchBang Linux users have been looking at?

    ArchBang — CrunchBang Linux (usually based on Ubuntu)- ported over to Arch Linux. Note: it’s not officially supported or anything like that…

    Here’s the thread: http://crunchbanglinux.org/forums/topic/5988/to-those-who-managed-to-get-a-archbangcruncharch/

    Please do tell us what you think of it, I look forward to hearing your opinion πŸ˜‰ .

    Reply
  4. Pingback: A simple batch encryption loop « Motho ke motho ka botho

Leave a reply to K.Mandla Cancel reply