# Apostrophe in target file path causes export problem

**URL:** https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431
**Category:** Fixed Bugs
**Tags:** bug-fixed
**Created:** [December 9, 2021, 4:14pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431 "2021-12-09T16:14:58Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Freddy](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@Freddy](https://community.mp3tag.de/u/Freddy)
#### Post date: [December 9, 2021, 4:14pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/1 "2021-12-09T16:14:58Z")

</div>

Hi there, long-time MP3Tag fan and first post.

Using: Mp3tag v3.11 / Win7-64

Problem: File \> Export. If the destination path for the export file contains an apostrophe in the names, there is still an export file created but it is in the current default directory with filename "[SYNTAX ERROR IN FORMATTING STRING]".

The problem goes away if I remove the apostrophe from the target destination path.

Other aspects of MP3Tag (eg reading tags) function correctly when there are apostrophes in the file paths.

The work-around is to avoid having apostrophes in the path to an export destination, but nonetheless this is a bug and had me scratching my head for a while.

Best regards

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 9, 2021, 4:18pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/2 "2021-12-09T16:18:13Z")

</div>

How do you create the export filename?  
I think that the apostrophes in format strings always either have to be replaced with 2 of them or removed alltogether as they otherwise enclose a literal string - and if that is missing the closing apostrophe, then you get a syntax error..

---

<div class="post-metadata">

### Author: ![Freddy](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@Freddy](https://community.mp3tag.de/u/Freddy)
#### Post date: [December 9, 2021, 4:53pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/3 "2021-12-09T16:53:00Z")

</div>

It's not the export _filename_ I'm talking about, it's the _file path_. The path is chosen from the existing directory tree using the file system browser window.

But you're right: if I edit the "Export file name" box in the Export Configuration window (subsequent to selecting the export file in the file system browser) to "double up" the apostrophe in the path, it works.

Thanks for the work-around, but it's still a bug!

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 9, 2021, 6:06pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/4 "2021-12-09T18:06:42Z")

</div>

I agree - this is unexpected. You are requested to enter a filename, not a format string (although it is one).  
You enter a text constant and it is treated like a variable string that needs processing.  
I set the name mm'mm.txt  
If the filename is set in $filename() and contains an apostrophe, you get the error message that the filename has a malformed parameter specification.  
I tried this also mit mm'mm.txt  
Fascinatingly, if the referenced data contains an apostrophe then there is no error.  
With $filename(%title%.txt,utf-8) and TITLE = "Fishtrippin'", the file Fishtrippin'.txt is created without error.  
The help for $filename() or the input field for the export filename does not state that in fact a Format string is used with all its rules and specifica.

---

<div class="post-metadata">

### Author: ![Freddy](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@Freddy](https://community.mp3tag.de/u/Freddy)
#### Post date: [December 9, 2021, 6:36pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/5 "2021-12-09T18:36:52Z")

</div>

I have no doubt what you say is correct, but it need not be as complicated as that.

By clicking the breadcrumb trail button to the right of the filename box, you get a browser to select destination folder and filename (if it exists). No need to enter anything, just point and click. The reason I discovered the fault is because I happen to have a folder "freddy's" in which I wanted to capture the export. It took some time for me to work out what was causing it.

I submit a user is more likely to be navigating by point-and-click than typing into the Export Configuration.

As there is no moratorium on apostrophes in folder and file names, MP3Tag really ought to accept them without having to manually escape apostrophes (or any other character valid in Windows paths).

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 9, 2021, 6:48pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/6 "2021-12-09T18:48:12Z")

</div>

Indeed. I tried to support your observation.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [February 13, 2022, 4:00pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/7 "2022-02-13T16:00:41Z")

</div>

This is now fixed with [Mp3tag v3.12a](https://community.mp3tag.de/t/455).

---

<div class="post-metadata">

### Author: ![Freddy](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@Freddy](https://community.mp3tag.de/u/Freddy)
#### Post date: [February 13, 2022, 5:21pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/8 "2022-02-13T17:21:49Z")

</div>

Super, thank you very much.

---

<div class="post-metadata">

### Author: ![nelsonj3](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/e79b87/32.png) [@nelsonj3](https://community.mp3tag.de/u/nelsonj3)
#### Post date: [March 7, 2022, 7:22pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/9 "2022-03-07T19:22:19Z")

</div>

I am still experiencing this issue.

I am running v3.12a.

Using "Tag - Filename" with the format string "z:\Music\Jonathan's Music%albumartist%%track% - %title%" as the format string I still get "Syntax Error" as the result.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [March 7, 2022, 7:33pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/10 "2022-03-07T19:33:00Z")

</div>

If you enter a string constant like "Jonathan's" in a format string, you have to escape the apostrophe.  
You will not get an error from data with apostrophe as found in a field contents

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [April 6, 2022, 7:33pm UTC](https://community.mp3tag.de/t/apostrophe-in-target-file-path-causes-export-problem/55431/11 "2022-04-06T19:33:34Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
