Hi all. I've recently scripted a component to a custom profile system I've been testing on my shard. Everything works quite well, however I have problem when it comes to saving information to a string, and then parsing that string into a URL.
Example is below:
Code:
this.AddHtml(15,51,270,20,"<A HREF=\"http://www.(edited for advertisement)+ temp + "\">Click for " + temp + "'s Webpage",false,false);
As seen here, this bit of HTML is empoyed in a gump, which references an account tag, as follows:
Code:
string temp=((Account)((Mobile)who).Account).GetTag("PROFILELINK" + who.Name);
Basically, a player has the option of saving a "profile", a string that contains, at the moment, any collection of characters, which is then parsed directly into the above line of code in a gump, which ultimately creates a clickable URL.
As I said, this works wonderfully as is. For example, this code would automatically check the string stored as the PROFILELINK account tag, parse that string into the URL, and then open. However, with browsers other than Internet Explorer, when a space is used to seperate two words, the gump simply fails to open the browser (obviously due to the browser recognizing bad syntax in the URL created by above code. Mozilla/FireFox does not like white spaces!).
I've tested using an underscore ( _ ) between two words as opposed to a simple space, and voila, it works fine for just about every browser (save for Chrome). Thus, my issue inherent is as follows:
How can I have the line of code in the gump recognize white space as an underscore? I think this approach would be more practical than saving the string's white space as underscores, or even my last resort, posting a disclaimer that instructs players to use an underscore instead of a space.
And for the inquiring minds wondering why on earth I'd want a space between two words that are used to create a viable web-link, the website I created to use this system recognizes spaces between words automatically as underscores. If it wasn't for the FireFox issue, the script would be fine as is.
Any help would be duly appreciated. Again, I'm essenitally just looking for a way to either replace spaces in a string with underscores automatically, or have an AddHtml gump line of code that automatically recognizes and replaces spaces with underscores.
Oh, and Merry Christmas to those Christian folk out there!