- Home /
How to supress a # into a path string
I try to load a file with WWW : the problem is one folder of the file got a "#" in his name.
How could i supress it ? I already try "@" before my string variable named "path" like this :
WWW www = new WWW("file://" + @path);
and it didn't work. Any idea ?
Have you tried String.Trim? http://msdn.microsoft.com/en-us/library/d4tt83f9.aspx
Answer by Kryptos · Oct 16, 2012 at 12:52 PM
URL can only contains alphanumeric characters. "#" is considered a special character.
Two solutions:
Rename the folder. It is not standard to have a "#" in a path name.
Encode the "#" character so that it fits the urlencoded standard, in this case %23. For that purpose, you can use WWW.EscapeURL().
You're welcome. Also note @fafase comment: String.Trim can be useful when you want to remove a particular character from a string.
Yep but if i "remove" character, it's a problem when i try to access the folder because the folder with this name doesn't exist (obviously). But i take the first solution : Rename all crappy folder with a #.