System.ArgumentException illegal characters in path
Asked Answered
C

3

5

I am using Path.Combine, and one of the strings contain a Unicode characters. I get {System.ArgumentException} exception; illegal characters in path.

According to MSDN filepath/name can have unicode characters. Why do I get this exception?

Edit:

Here is the code:

Path.Combine("C:\PDM\Silver","Amabel Bender QQQ")
Cultivar answered 15/12, 2008 at 8:49 Comment(2)
Probably easier if we can see the code...Carpo
Could you post the path in question?Xylon
C
8

I figured out the problem. The second string contains a "tab" character in it causing the exception. (that didn't showed up when I pasted the string here)

Thanks everyone and sorry for the confusion.

Cultivar answered 15/12, 2008 at 9:34 Comment(1)
I just posted the exact same suggestion at the same time :)Townswoman
T
3

You may have double quotes in your set of paths, since Path.InvalidPathChars includes double-quotes.

That would make your exception unrelated to your Unicode character...


Just saw your edit of your question: VB, no quotes.

So may be you have a non-printable character copied in your second string, which looks like a space, just before your 'QQQ' string ?
Try also if "Amabel BenderQQQ" or "AmabelBenderQQQ" work (just to test if it is related to 'QQQ' chars or to the space)

Townswoman answered 15/12, 2008 at 9:7 Comment(0)
C
2

If you are using C# then I'm sure you need to escape the back-slashes

Path.Combine("C:\\PDM\\Silver","Amabel Bender QQQ")

not applicable if you are using VB though...

Carpo answered 15/12, 2008 at 9:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.