Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Exclusion of underline chars in UrlEncode function
Exclusion of underline chars in UrlEncode function [message #25818] Sat, 13 March 2010 21:24 Go to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
No need to encode underline chars in UrlEncode function result.

File Web/util.cpp around 91 line:
String UrlEncode(String s)
{
	const char *p = s, *e = s.End();
	String out;
	for(; p < e; p++)
	{
		const char *b = p;
		while(p < e && (byte)*p > ' ' && (byte)*p < 127
			&& (IsAlNum(*p) || *p == ',' || *p == '.' || *p == '-' || *p == '_'))
			p++;
		if(p > b)
			out.Cat(b, int(p - b));
		if(p >= e)
			break;
		if(*p == ' ')
			out << '+';
		else
			out << '%' << hex_digits[(*p >> 4) & 15] << hex_digits[*p & 15];
	}
	return out;
}

[Updated on: Sat, 13 March 2010 21:40]

Report message to a moderator

Re: Exclusion of underline chars in UrlEncode function [message #25848 is a reply to message #25818] Mon, 15 March 2010 14:38 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Sender Ghost wrote on Sat, 13 March 2010 15:24

No need to encode underline chars in UrlEncode function result.

File Web/util.cpp around 91 line:
String UrlEncode(String s)
{
	const char *p = s, *e = s.End();
	String out;
	for(; p < e; p++)
	{
		const char *b = p;
		while(p < e && (byte)*p > ' ' && (byte)*p < 127
			&& (IsAlNum(*p) || *p == ',' || *p == '.' || *p == '-' || *p == '_'))
			p++;
		if(p > b)
			out.Cat(b, int(p - b));
		if(p >= e)
			break;
		if(*p == ' ')
			out << '+';
		else
			out << '%' << hex_digits[(*p >> 4) & 15] << hex_digits[*p & 15];
	}
	return out;
}



OK, why not... Smile

Mirek
Previous Topic: Why ie cannt catch messages from keyboard and mouse
Next Topic: Proxy Authentication Required
Goto Forum:
  


Current Time: Sat Apr 20 05:16:40 CEST 2024

Total time taken to generate the page: 0.04383 seconds