Sign in to follow this  

[.net] Special characters

This topic is 4530 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all I just descided to write a small search app that i could use to help facilitate my searching. At first i thought about displaying the search results in the app but that's way to advanced for me seeing as i'd have to know how to implement an internet explorer window in my app which i have no idea how to do. (If you know how, feel free to post information, i'm hoping that a suitable control will be available in Forms 2.0 in VS 2005) In any case, in the swedish language and others we have 3 extra characters, Å, Ä and Ö. If they're not displayed properly the first one is an A with 1 dot over it's head. The second is an A with 2 dots over it's head, located beside each other. The third is an O with 2 dots located beside each other. Here's the problem, htm(l) and misc has certain keycodes for these characters, and when searching in google they're converted. For example, "Fält", would be converted into, "f%C3%A4lt". I'm wondering if there's any built-in support of doing this or if i'm going to have to search the search query for these characters? (If so, how could i do this the fastest?)

Share this post


Link to post
Share on other sites
Quote:
Original post by Cybrosys
Hi all

I just descided to write a small search app that i could use to help facilitate my searching. At first i thought about displaying the search results in the app but that's way to advanced for me seeing as i'd have to know how to implement an internet explorer window in my app which i have no idea how to do. (If you know how, feel free to post information, i'm hoping that a suitable control will be available in Forms 2.0 in VS 2005)

In any case, in the swedish language and others we have 3 extra characters, Å, Ä and Ö. If they're not displayed properly the first one is an A with 1 dot over it's head. The second is an A with 2 dots over it's head, located beside each other. The third is an O with 2 dots located beside each other.

Here's the problem, htm(l) and misc has certain keycodes for these characters, and when searching in google they're converted.

For example, "Fält", would be converted into, "f%C3%A4lt". I'm wondering if there's any built-in support of doing this or if i'm going to have to search the search query for these characters? (If so, how could i do this the fastest?)


Look up the WebBrowser control. It can display HTML. Also, strings in .Net are unicode by default (UTF-8, although you can change that as well).

Share this post


Link to post
Share on other sites
Thanks for the fast reply. I'll check up the control. The problem is that when searching normally at google's main site it converts the character(s) before sending them off to the main search engine.

Another misc problem i'm having is that i've overloaded my main form's KeyDown event but it never gets the event, the textboxes doesn't pass it down to the main form.

Share this post


Link to post
Share on other sites
Quote:
Original post by Cybrosys
Thanks for the fast reply. I'll check up the control. The problem is that when searching normally at google's main site it converts the character(s) before sending them off to the main search engine.

Another misc problem i'm having is that i've overloaded my main form's KeyDown event but it never gets the event, the textboxes doesn't pass it down to the main form.


The control with the focus handles it. If you want to dispatch it to the main form, you'll have to manually do that.

Share this post


Link to post
Share on other sites
Also, the reason they are converted to that is just the way it works. The %<num>%<num> is because they are unicode characters. The numbers are hexidecimal in nature, so if you can convert each non-ansi character to hex, then you could simply do the translation manually (HtmlEncode should be able to do it as well, however that would require an ASP.Net server object.)

Share this post


Link to post
Share on other sites
Sorry for being a bit of a nuisance, heading over to google to find some more info but in the mean time i can't find the WebBrowser control. I've gone through the list that pops up when selecting add/remove items to the windows forms list but i can't find WebBrowser control from the .Net Framework components, sorry.

Share this post


Link to post
Share on other sites
You know what, that's a .net 2.0 control. There is one for .net 1.1, but i just can't find it right now.

Share this post


Link to post
Share on other sites
A, thought something like that was up =) Well i've got the beta 2 of 2005 lying next to me, just haven't had the guts to install it because of all the problems i've glanced over, but maybe there's nothing to worry about? =)

Share this post


Link to post
Share on other sites
Hehe ic ic, thanks again =)

Btw, the HttpUtility class sure fixed the problem, just had to use the UrlEncode function which, as you said, converted any "weird" characters.

Share this post


Link to post
Share on other sites
Here comes another question, remember me talking about the KeyDown event not being passed to the parents etc, well as stated i had to manage the escape press for every control i've added, which is somewhat screwed up, but i've got LinkLabels and when one is selected focused, esc won't register at the main form which i thought it would seeing as the LinkLables don't manage key events :S

Share this post


Link to post
Share on other sites

This topic is 4530 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this