\\ problem

How can I prevent Mp3tag messing with \\ in fields?

If on V2.49 I edit a field containing "\\", Mp3tag changes what I see to ", ".

I guess the program thought I wanted multiple values. But even then, it messes up - if I edit again, it concatenates the multiple values with ", " into a single value

I want it to keep my value intact regardless.

chrisjj, at first I recommend reading this thread ...
/t/11800/1
... then come back and we may discuss the "\\ double backslash problem" resp. the "built in multi-value functionality" from another point of view.

DD.20120225.0841.CET

Thanks Detlev, but that topic tells me nothing I don't already know. And what I seek is a solution not a discussion.

I don't understand the problem fully.

Do you want to use "\\" as literal characters?
Where do you see "\\" displayed as ", "? At the main window, in the tag panel, in the extended tags dialog, or in an external application?

I don't understand the problem fully.

Simply load a track having \\ in a field e.g. and edit it in the main window. You'll see it change to ", ".

e.g.

Click the Description field, press RETURN. See:

Do you want to use "\\" as literal characters?

I am using them as literal characters, entered using another app. I want Mp3tag just not to mess that up.

Where do you see "\\" displayed as ", "? At the main window

Yes.

That's a bit of a problem. Mp3tag is using "\\" as a syntax character which tells the programm to split the tag field. As far as I know, there is no proper way to escape that syntax function of "\\".

There are a few workarounds:
Mp3tag only splits the fields in these cases:

  • if the field is displayed at the the tag panel and you save the file
  • if you open the extended tag panel and leave it with pressing "OK"
  • if you click into the field at the main window
    (for the first two cases, the fields are only splitted when all selected files have the same values)
    If you can avoid those cases, you are fine.

If not, you can make an action to reverse the splitting:

Action: Merge dublicate fields
Field: DESCRIPTION
Seperator String: \\

Or you can do an regex replace action, to insert a zero width space between the the two characters. With this trick, the field looks like before, but it isn't splitted because there is an invisible character between the two "\\". But if you use that description field to be read by another application, there could be problems that the filepath you are storing there isn't recognized any more.

Action: Replace with regular expression
Field: DESCRIPTION
Regular expression: \\
Replace matches with: \\x{200B}\\

You have to do this before the fields are splitted. If you want to do it afterwards, merge the fields again an join that with using that zero width space, use:

Action: Format Value
Field: DESCRIPTION
Formatstring: $regexp($meta_sep(description,\\),\\,\\x{200B}\\)

If you can avoid those cases, you are fine.

The problem occurs when editing the field. You're suggesting avoiding all cases that edit the field, right?.

If not, you can make an action to reverse the splitting:
Action: Merge dublicate fields

That messes-up fields that weren't split by the first mess-up.

Or you can do an regex replace action, to insert a zero width space ... But if you use that
description field to be read by another application, there could be problems

Yes it will totally break the external use.

Thanks for the suggestions.

The problem occurs when editing the field. You're suggesting avoiding all cases that edit the field, right?.

Yes. whenever you edit a field with "\\" in Mp3tag it gets splitted. But you can edit other fields in the same file.

That messes-up field that weren't split by the first mess-up.

No, if fields aren't splitted, they don't get changed by the "Merge dublicate fields" action.

OK, thanks. I'll suggest this be fixed.

I meant it messes up /split/ fields that weren't split by the first mess-up. Sorry to be imprecise.