Contact

admin

About Me · Send mail to the author(s) E-mail · Twitter

At GROSSWEBER we practice what we preach. We offer trainings for modern software technologies like Behavior Driven Development, Clean Code and Git. Our staff is fluent in a variety of languages, including English.

Feed Icon

Tags

Open Source Projects

Archives

Blogs of friends

Now playing [?]

Error retrieving information from external service.
Audioscrobbler/Last.fm

ClustrMap

Page 1 of 2 in the Browser category Next Page

Building UTF-8 Compatible QueryStrings (Not Only) for ASP.NET

Posted in ASP.NET | Browser at Friday, 22 September 2006 20:53 W. Europe Daylight Time

Whenever you append a query string to an URL, it's a best practice to URL-encode the query string value. On the server side encoding can be done by three methods of the System.Web.HttpUtility class, depending on the desired output.

Here's an example passing "Encoding Test: abcäöüß" to the methods:

Method Output
HttpUtility.UrlEncode Encoding+Test%3a+abc%c3%a4%c3%b6%c3%bc%c3%9f
HttpUtility.UrlEncodeUnicode Encoding+Test%3a+abc%u00e4%u00f6%u00fc%u00df
HttpUtility.UrlPathEncode Encoding%20Test:%20abc%c3%a4%c3%b6%c3%bc%c3%9f

The single method HttpUtility.UrlDecode() decodes all encoded query strings.

On the client side there are JavaScript functions to encode and decode query strings, namely escape() and unescape(). However, these functions have problems with the correct encoding of UTF-8 strings.

Today I had the same problem described in the article above while debugging search in dasBlog, which uses UTF-8 as the default request and response encoding. You can enable UTF-8 for any ASP.NET web site by including the following element in your web.config.

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

All search queries containing umlauts were retrieved without umlauts on the server side, so a query for König would result in Knig. The solution was to leverage the newer encoding functions encodeURIComponent() and decodeURIComponent() respectively which handle Unicode.

If you're interested in encoding in general I recommend Scott Hanselman's excellent podcast on globalization and internationalization. It gives a good overview without diving too deep into the details.

By the way, I recommend having a look at QuickRef.org, I really like their fast Ajax-enabled search engine for references of C, C++, CSS, HTML, HTML DOM, Java, JavaScript, MySQL, Perl, PHP and Ruby.

Now playing: New Order - Get ready - Vicious streak

Mozilla Firefox

Posted in Tools and Software | Browser at Wednesday, 03 May 2006 21:02 W. Europe Daylight Time

I found a nice quote that describes my feelings about Firefox pretty well. Who needs IE 7?

More than anything else, this is the smartest aspect of what Mozilla has done with Firefox: It's a realistic browser, a worthy successor to the Navigator line. It's a browser that inspires an emotional response. You don't have to learn to like it with your left brain; you just like it.

Automatic NTLM Authentication in Firefox

Posted in Tools and Software | Browser at Friday, 28 April 2006 11:47 W. Europe Daylight Time

I didn't know this is possible, but Firefox actually supports automatic NTLM authentication for certain domains. Whereas there's a global setting in IE to enable Windows Integrated Authentication, you'll have to enable NTLM authentication in Firefox on a per-domain basis.

This is especially useful if you are browsing intranet sites using Firefox that require NTLM authentication. In this case Firefox will bug you with a username/password dialog when accessing the site unless the domain isn't whitelisted.

Firefox NTLM Settings

There are good reasons for explicit whitelisting:

By default, Mozilla rejects all SPNEGO challenges from a web server. This is to protect the user from the possibility of DNS-spoofing being used to stage a man-in-the-middle exploit (see bug 17578 for more info). Moreover, with Windows clients NTLM may be negotiated as the authentication protocol. So, it is paramount that the browser does not freely exchange NTLM user credentials with any server that requests them. The NTLM response includes a hash of the user's logon credentials. On older versions of Windows this hash is computed using a relatively weak algorithm (see Hertel for more info on NTLM authentication).

[Via Dare Obasanjo]

Now playing: Big Bud - Fear of flying - Rice'n'beans

Customizing the Firefox UI

Posted in Browser at Tuesday, 04 April 2006 19:27 W. Europe Daylight Time

Firefox LogoThe last weeks I've been totally blown away by the Firefox user experience. Not only that it is a fast and standards-compliant browser, there is a vast list of extensions out there to tailor the browser to your needs. All plugins I've seen so far work and are updateable in non-admin environments. One may think I am an extension junkie, but see for yourself.

Some days ago Gunnar recommended the Yahoo! Widget Engine to me. I've decided to give it a try and I am pretty happy so far. The volume control widget even replaced the volume control that comes with my sound card. As I use the volume control fairy often, I like it to be visible on top of other applications. The widget engine allows just this by setting "on top" in the widget's properties. Add a little transparency and you're done. I've decided to place the widget in the lower right corner of the screen. However, Firefox has some controls placed there that aren't clickable because the widget sits on top of them.

Standard Firefox Status Bar

Firefox won't be Firefox if there were no means of moving the controls out of the way and thus giving access to both the Firefox buttons and volume control: There is the possibility of placing a userChrome.css file inside the Firefox user profile under C:\Documents and Settings\<User Name>\Application Data\Mozilla\Firefox\Profiles\<Random Number>.default\chrome\. Using this CSS stylesheet, it's possible to control any aspect of the browser appearance.

/*
 * Do not remove the @namespace line -- it's required for correct functioning
 */
/* set default namespace to XUL */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/*
 * Pad the status bar from the right if Firefox is maximized to display Yahoo's
 * volume control widget without underlying Firefox controls.
 */
#main-window[sizemode="maximized"] #status-bar {
  padding-right: 172px !important;
}

Once the above file sits in in the profile directory, each time Firefox is maximized the status bar is indented 172 pixels from the right.

Customized Firefox Status Bar

I was surprised to see that I was able to put the stylesheet together in about 5 minutes. There's plenty of documentation and samples on the web regarding XUL applications, and Firefox is one.

Now playing: Ethereal 77 - Landscapes - Baltica

Mozilla Firefox Tabbed Browsing Extensions

Posted in Tools and Software | Browser at Friday, 20 January 2006 14:07 W. Europe Standard Time

Finally, I found some extensions that enables Firefox tabbed browsing behaving similar to Maxthon:

  • Super DragAndGo
    Simply drag a link to open it in a new tab or drag selected text on the page to open a web search using the default search engine. An absolute must-have!
  • Focus Last Selected Tab
    After closing a tab, the previously active tab is selected. Without this extension the left-handed tab of the closed one is selected instead.
  • Tab Clicking Options
    Enables close-on-doubleclick and the like.
  • Tab Catalog
    Shows previews of opened tabs.
  • Undo Close Tab
    Re-opens the last closed tab. Not as powerful as Maxthon's Undo functionality as it has no history. Still better than nothing.

Some more plugins I've installed:

Now playing: Supergrass - Road to Rouen - Kick in the teeth

Page 1 of 2 in the Browser category Next Page