Libation icon indicating copy to clipboard operation
Libation copied to clipboard

Character replacement failed on stylized single quote

Open pixil98 opened this issue 2 years ago • 2 comments

Describe the bug I tried liberating this book, you'll notice the author's name is written with a stylized closing single quote. I have both stylized single quotes setup to be replaced with a standard single quote:

  "ReplacementCharacters": {
    "Replacement": [
      {
        "CharacterToReplace": "\u0000",
        "ReplacementString": "_",
        "Description": "All other invalid characters"
      },
      {
        "CharacterToReplace": "/",
        "ReplacementString": "_",
        "Description": "Forward Slash (Filename Only)"
      },
      {
        "CharacterToReplace": "\\",
        "ReplacementString": "_",
        "Description": "Back Slash (Filename Only)"
      },
      {
        "CharacterToReplace": "\"",
        "ReplacementString": "'",
        "Description": "Open Quote"
      },
      {
        "CharacterToReplace": "\"",
        "ReplacementString": "'",
        "Description": "Close Quote"
      },
      {
        "CharacterToReplace": "\"",
        "ReplacementString": "'",
        "Description": "Other Quote"
      },
      {
        "CharacterToReplace": "<",
        "ReplacementString": "{",
        "Description": "Open Angle Bracket"
      },
      {
        "CharacterToReplace": ">",
        "ReplacementString": "}",
        "Description": "Close Angle Bracket"
      },
      {
        "CharacterToReplace": ":",
        "ReplacementString": "-",
        "Description": "Colon"
      },
      {
        "CharacterToReplace": "‘",
        "ReplacementString": "'",
        "Description": "opening single quote"
      },
      {
        "CharacterToReplace": "’",
        "ReplacementString": "'",
        "Description": "closing single quote"
      }
    ]
  },

Here is the resulting folder, note the stylized quote.

drwxr-xr-x  3 k8s k8s  3 Aug 12 21:47 'Robert O’Brien'

To Reproduce Steps to reproduce the behavior:

  1. Setup your Settings.json with the above replacements
  2. Try liberating the book

Expected behavior I'd expect it to write the author's folder name using the substituted single quote

Platform Linux -- Docker image https://hub.docker.com/r/pixil/libation Sorry there isn't any documentation written for the Docker image yet. I'd be happy to help set it up if you want to try using it.

Log Files Log202208.log

pixil98 avatar Aug 13 '22 03:08 pixil98

Right now, character replacement only works for illegal path/filename characters and is not a general character replacement tool.

Illegal Windows Filename Characters | \0 \u0001 \u0002 \u0003 \u0004 \u0005 \u0006 \a \b \t \n \v \f \r \u000e \u000f \u0010 \u0011 \u0012 \u0013 \u0014 \u0015 \u0016 \u0017 \u0018 \u0019 \u001a \u001b \u001c \u001d \u001e \u001f * ? : "

@rmcrackan This should probably be converted to a feature request

Mbucari avatar Aug 15 '22 20:08 Mbucari

@Mbucari Good call

rmcrackan avatar Aug 16 '22 11:08 rmcrackan

@Mbucari This gets even more fun in x-plat. A user noted we're replacing colon even though it's a valid path character in Linux.

rmcrackan avatar Dec 06 '22 12:12 rmcrackan

Great! XD

Mbucari avatar Dec 06 '22 16:12 Mbucari

Fixed in @Mbucari 's latest PR -- #412 . Will go out with the next release

rmcrackan avatar Dec 17 '22 02:12 rmcrackan