Illegal characters in path error
Posted on 2006-05-09
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)
But the System.IO.Path.InvalidPathChars doesn't contain these special characters. What should I try next?