Link to home
Start Free TrialLog in
Avatar of ID3TECH
ID3TECH

asked on

Illegal characters in path error

Greetings Experts,
I keep getting the "Illegal characters in path" error, and it seems to come from the System.IO.FileInfo constructor, from System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str).

The characters which trigger this error are special french characters like é, è, à, etc... So my question is:
Is there a way to either allow these characters, or remove them from the filename with some kind of parsing method.

I tried making this method:

        Public Shared Function HasIllegalCharacters(ByVal path As String) As Boolean
            Return (path.IndexOfAny(System.IO.Path.InvalidPathChars) >= 0)
        End Function

But the System.IO.Path.InvalidPathChars doesn't contain these special characters. What should I try next?
ASKER CERTIFIED SOLUTION
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial