Characters used in filenames, export script

I'm writing an export configuration to create a script that will copy selected files to a new location. I'm having issues with failures because of how characteres are interpreted. I'm on Windows 10.

In MP3tag, it looks like this:

The .bat file command my export produces looks like this:

When the script executes, this happens:

This is one example of a few hundred, seems that Windows allows a character in a filename, that, when the %_path% does it's thing ends up writing a string and Windows doesn't interpret the same way. I can imagine several ways to fix this (including renaming all the files that have an odd character in them), is there a good path past that others have found?

Thanks,

Marc Nowell

Perhaps you have to set the encoding right for the export file - e.g. UTF8

I tried ansi, utf8, and utf16. Ansi and utf8 provide the same result, utf16 provides a different but also wrong character result.

I just stumbled upon the "Convert Codepage" action. I converted the codepage of the Title tag to English, which I was assuming it already was. Did a Convert Tag -> Filename to rename the file, then it worked just fine.

This could also work depending which apostrophe character you have in your filename:
Use ansi encoding in export and write at the beginning of your bat file chcp 1252

This is an interesting option, didn't know it existed. I'm reading more about it, but it's not solving the issue in my case.

The convert codepage action I wrote about above solves this for apostrophes ('), but not for German characters, which I have a lot of in classical music.

Research continues...

Morning learnings -- I had various $filename options at the front of the file. I had played with ansi, utf-8, and utf-16 here, none of which gave good results. The filename that showed correctly in the Mp3Tag data window is NOT what was being output by the export command.

I played a lot with codepages and unicode, trying to see what was expected where. In a effort to get back to basics, nothing, I completely deleted the %$filename(bat, uft-8) line, ran the export again, and I got working results from characters that match the filenames.

From the Mp3tag Help web page, under Configuration > Export Placeholders for export configurations > Technical info, %_id3v2_character_encoding% (Encoding of the ID3v2 text frames of the file) is listed. This field seems to be empty for all of the files that I've looked at.

Configuration > Actions > Convert codepage is something that I tinkered with earlier and thought it had a good effect on my issue, now I'm not sure. It speaks to problems displaying text and converting from a specified codepage to Unicode, if I understand it correctly. It seems you'd need to know what codepage you're coming from, which I can't tell. It all looks correct on the screen.

This placeholder only works if a file has ID3v2 tags.
"convert codepage" is for fixing tags that don't show correctly in Mp3tag.

What's your Windows language?

You can also try this in your export (and you need to disable "Write BOM" at File > Options > Export for this to work)
$filename(Test.bat,utf-8)chcp 65001

After my last post, I had some success with your tips from your earlier post. Maybe I hadn't tried the right combination before.

Yes, taking out the BOM seemed key.

Windows language is English, USA.

I just looked up chcp 65001 and UTF-8, interesting stuff, more I need to learn there. It also implies that this is inherently a command shell issue, I was planning on eventually taking this into PowerShell if I could learn enough about how the Mp3Tag Export configuration and filters, sorts in Mp3Tag can solve that end of the need.

Some more talk about the issue outside of what I'm trying to do: https://stackoverflow.com/questions/57131654/using-utf-8-encoding-chcp-65001-in-command-prompt-windows-powershell-window

Thanks for the pointers!