# \[F\] $validate() broken?

**URL:** https://community.mp3tag.de/t/f-validate-broken/8311
**Category:** Fixed Bugs
**Tags:** bug-fixed
**Created:** [April 28, 2009, 7:53pm UTC](https://community.mp3tag.de/t/f-validate-broken/8311 "2009-04-28T19:53:39Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [April 28, 2009, 7:53pm UTC](https://community.mp3tag.de/t/f-validate-broken/8311/1 "2009-04-28T19:53:39Z")

</div>

I find that **$validate(aaa \ bbb,\_)** returns not **aaa \_ bbb** as expected, and as observed on versions until recently, but **aaa\ bbb** (note also the missing space before **\</b\>).**

Bug?

Also, **$validate(aaa \ bbb,\_)\t** returns **aaa \ bbb\t** i.e. does not omit that space.

---

<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: [May 2, 2009, 5:31am UTC](https://community.mp3tag.de/t/f-validate-broken/8311/2 "2009-05-02T05:31:19Z")

</div>

The backslash is a valid character for separating directories in a file path. The spaces before a backslash will be removed anyway, but I'll try to make this more consistent in the UI with a future release.

Kind regards,  
Florian

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [May 3, 2009, 1:46am UTC](https://community.mp3tag.de/t/f-validate-broken/8311/3 "2009-05-03T01:46:40Z")

</div>

> The backslash is a valid character for separating directories in a file path.

Backslash is an invalid character in a fileNAME, and since $validate() is described as "Remove invalid characters from filename", $validate() should remove backslash.

---

<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: [May 9, 2009, 5:21am UTC](https://community.mp3tag.de/t/f-validate-broken/8311/4 "2009-05-09T05:21:03Z")

</div>

OK, I'll then update the documentation accordingly. Many users are using this function with file paths and a change would break all those scripts.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [May 9, 2009, 8:07am UTC](https://community.mp3tag.de/t/f-validate-broken/8311/5 "2009-05-09T08:07:14Z")

</div>

Fair enough! Thanks.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [July 7, 2009, 1:22pm UTC](https://community.mp3tag.de/t/f-validate-broken/8311/6 "2009-07-07T13:22:19Z")

</div>

> I find that **$validate(aaa \ bbb,_)_** _returns ... **aaa\ bbb** (note ... the missing space  
> Bug?  
> **$validate(aaa \ bbb,**_**)\t** returns **aaa \ bbb\t** i.e. does not omit that space.

Any thoughts on specifically this missing space, Florian?

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [July 7, 2009, 4:33pm UTC](https://community.mp3tag.de/t/f-validate-broken/8311/7 "2009-07-07T16:33:43Z")

</div>

I want to throw in that ...

... a string like this:

**" aaa \ bbb \ ccc "**

... should be fixed to:

**" aaa\ bbb\ ccc"**

in order to be a valid path string for the disksystem.

DD.20090707.2033.CEST

---

<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: [July 12, 2009, 5:28pm UTC](https://community.mp3tag.de/t/f-validate-broken/8311/8 "2009-07-12T17:28:56Z")

</div>

[Fixed](http://developer.mp3tag.de).

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [July 13, 2009, 4:44pm UTC](https://community.mp3tag.de/t/f-validate-broken/8311/9 "2009-07-13T16:44:21Z")

</div>

Florian, I did a few tests - not all yet - and it looks good so far, but ...

... having this invalid string  
"D:;\FOL_DER;\<FOLDER\>\..;A:?/_"

... then preview shows, e. g.  
"D:\Programme\Mp3tag\D;\FOLDER;;A.mp3"  
Looks perfect cleaned and canonicalized.

But the dialog shows the non canonicalized path.  
 ![](https://community.mp3tag.de/uploads/default/original/2X/0/0301b408c2bceb66ff29afa2a98c3f6b8809cabe.jpg)

Please look into again.  
... and try to suppress ascii values below 32 too.

Regards  
Detlev

DD.20090713.12043.CEST

![](https://community.mp3tag.de/uploads/default/original/2X/0/0301b408c2bceb66ff29afa2a98c3f6b8809cabe.jpg)

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [July 13, 2009, 5:35pm UTC](https://community.mp3tag.de/t/f-validate-broken/8311/10 "2009-07-13T17:35:15Z")

</div>

> ... having this invalid string  
> "D:;\FOL_DER;\<FOLDER\>\..;A:?/_"

That's a cruel test... Well done! 🙂

> ... then preview shows, e. g.  
> "D:\Programme\Mp3tag\D;\FOLDER;;A.mp3"  
> Looks perfect cleaned and canonicalized.

Likewise for me on your example:  
[☹  
 ](http://img188.imageshack.us/i/36157105.gif/)

> Please look into again.

Let's not be too hasty here. The dialog's live preview has never shown the full path, just the part of the path corresponding to the Format String, validated. I think careful consideration is needed before changing the design intent.

---

<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: [July 19, 2009, 11:06am UTC](https://community.mp3tag.de/t/f-validate-broken/8311/11 "2009-07-19T11:06:10Z")

</div>

In the example Detlev was referring to, the folder was already party canonicalized which was is also the case for the example chrisjj brought up. Thanks for pointing!

This should now also be addressed in the current [Development Build](http://developer.mp3tag.de).

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [July 26, 2009, 7:03pm UTC](https://community.mp3tag.de/t/f-validate-broken/8311/12 "2009-07-26T19:03:04Z")

</div>

I want to add ...

Found this, related to PowerShell, the list of invalid chars seems to be complete.

PS \> "$($GetInvalidPathChars | foreach { [int]$\_ } )"  
34 60 62 124 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

PS \> "$($GetInvalidFileNameChars | foreach { [int]$\_} )"  
34 60 62 124 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 58 42 63 92 47

Regarding my example string ...  
From  
D:;\FOL_DER;\<FOLDER\>\..;A:?/_  
now cleaned and canonicalized to  
D;\FOLDER;;A.mp3

I noticed that the colon at position 2 was removed by Mp3tag v2.43c.  
Does this work without failures under all circumstances that may come up in Mp3tag?

DD.20090726.2300.CEST

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [October 2, 2009, 7:46am UTC](https://community.mp3tag.de/t/f-validate-broken/8311/13 "2009-10-02T07:46:35Z")

</div>

> Here it can show a /mis/-canonicalized path ☹

(That was: Format string: d:\folder..\file -\> minipreview d:\folder\file.wma)

I think this is unstable behaviour because now I find a different result - non-canonicalisation:

Format string: d:\folder..\file -\> minipreview d:\folder..\file.wma

(on V2.44)

Do you get this?

---

<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: [December 28, 2018, 2:01pm UTC](https://community.mp3tag.de/t/f-validate-broken/8311/14 "2018-12-28T14:01:19Z")

</div>

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