Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

RE: FN-FORUM: IIS changes escaped characters in URL... HELP!!!

date posted 31st January 2004 16:35

If anyone was intrigued by this problem, I have now solved it. The
characters were not being translated to %3F's, it's just that %3F's were
being used to display characters it couldn't display properly.
As I was creating a URL to use with 'window.open' I was using the
javascript command "escape" to handle the extended characters. That was
mistake number 1. Since Internet Explorer 5.5 (and NS/Moz 6) the command
"encodeURIComponent" should be used instead because in the words of
Microsoft: "escape doesn't always work properly with Unicode characters"...
Nice!
Changing the URL encoding to use the new function to encode using
codepage: UTF-8, and setting a processing directive in my (ColdFusionMX)
receiving page to decode using UTF-8 has cured the problem. I believe there
are similar "processing directive" type commands in both ASP and PHP to
achieve the same result.
It seems it only worked on my development system because it was all
using the same codepage anyway, but only by default.

If anyone is interested, below is a javascript function (found on
the web and then slightly modified by me) that will UTF-8 encode strings to
put in a URL that works on browsers that have the encodeURIComponent command
in Javascript by using that command, and also older browsers that don't by
using a replacement routine. Call the function using:

encodedString = utfEscape(originalString);

Cheers,

Dave.


//****************** start of snippet **************
/* ***************************
** Most of this code was kindly
** provided to me by
** Andrew Clover (and at doxdesk dot com)
** http://and.doxdesk.com/
** in response to my plea in my blog at
** http://worldtimzone.com/blog/date/2002/09/24
** It was unclear whether he created it.
*/
function utf8(wide) {
var c, s;
var enc = "";
var i = 0;
while(i=0xDC00 && c=0xD800 && c=wide.length) continue;
s= wide.charCodeAt(i++);
if (s=0xDE00) continue;
c= ((c-0xD800)>6&0x3F),0x80+(c&0x3F));
else enc +=
String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&
0x3F));
}
return enc;
}

var hexchars = "0123456789ABCDEF";

function toHex(n) {
return hexchars.charAt(n>>4)+hexchars.charAt(n & 0xF);
}

var okURIchars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";

function encodeURIComponentNew(s) {
var s = utf8(s);
var c;
var enc = "";
for (var i= 0; i



Messages by Day
January 31st 2004
January 30th 2004
January 29th 2004
January 28th 2004
January 27th 2004
January 26th 2004
January 25th 2004
January 24th 2004
January 23rd 2004
January 22nd 2004
January 21st 2004
January 20th 2004
January 19th 2004
January 18th 2004
January 17th 2004
January 16th 2004
January 15th 2004
January 14th 2004
January 13th 2004
January 12th 2004
January 11th 2004
January 10th 2004
January 9th 2004
January 8th 2004
January 7th 2004
January 6th 2004
January 5th 2004
January 4th 2004
January 3rd 2004
January 2nd 2004
January 1st 2004


Messages by Month
December 2004
December 2004
October 2004
October 2004
August 2004
July 2004
July 2004
May 2004
May 2004
March 2004
March 2004
January 2004


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000