|
| Web News |
Wave7 Optics to support launch of municipal FTTP... Wave7 Optics, a supplier of fibre-to-the-premises (FTTP) equipment, is supporting the launch of a municipal FTTP network that will serve businesses in 86 municipalities around Paris. The network, called SEQUANTIC, is a point-to-multipoint network initiated by the SIPPEREC...
The French chime in with “Me too!” Add France to the countries that have acknowledged that they are under attack from China. They are not willing to commit to having any knowledge of the attacks being sponsored by the People’s Liberation Army. And for the record here is China’s response to all these...
France blames China for hack attacks Three more western nations have blamed China for an upsurge in hacking attacks against government computers. Germany, the USA and the UK have all become the subject of targeted attacks originating from China, with many observers pointing the finger...
L'Oreal challenges eBay over sale of fakes L'Oreal, the world's largest cosmetics group, has launched legal action against eBay, alleging the online auctioneer does not do enough to combat the sale of counterfeits, the company said on Monday. The action by L'Oreal...
GlobalMedia rebrands as bigmouthmedia in France Digital marketing company GlobalMedia is rebranding itself in France as bigmouthmedia. GlobalMedia merged with bigmouthmedia, the European search marketing agency, in late 2006 and has since rebranded itself under the bigmouthmedia name in Norway and Sweden.
|
|
09.13.07 Cookies & Unicode Characters By
Mads Kristensen
I've been having some issues with storing Unicode characters in cookies today.
Whenever a cookie is set and the value filled with Unicode characters, the same characters cannot be retrieved from the cookie again. When they are retrieved from the requesting browser, they are changed into something totally unreadable.
Background
The cookie is set when a visitor enters some text into a textbox and submits the form. When the same visitor returns to that page I wanted to pre-fill the textbox with the value submitted earlier. Very easy and simple and not before someone noticed the
strange behaviour with Unicode characters I thought it worked just fine.
Because the value was displayed in a textbox I thought that maybe HTML encoding could solve the issue. Don't ever HTML encode a cookie in ASP.NET! It results in a yellow screen of death and an exception stating that the cookie contains dangerous characters. The dangerous character it was referring to was a HTML encoded representation of a Unicode character and looked something like this "#248;". The only thing to do is to delete your cookies in order to view that page again.
The solution
It took me a while to figure it out, but all you need to do is to URL encode the cookie value. It works no matter what encoding you use for the page. The example below illustrates the very simple solution:
It is so simple but caused me a lot of time investigating and clearing cookies from the browser.
Comments
About the Author: Mads Kristensen currently works as a Senior Developer at Traceworks located
in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in
2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and
web services in his daily work as well. A true .NET developer with great passion for the simple solution.
http://www.madskristensen.dk/
|
|