BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

URLEncode and Unicode

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Socket)
View previous topic :: View next topic  
Author Message
Hamid
Guest





PostPosted: Sun Jan 29, 2006 6:09 am    Post subject: URLEncode and Unicode Reply with quote




I'm using TNMURL to encode a url, but seemingly the component fails to encode urls containing Unicode characters. How can I solve the problem?

Thanx

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Jan 30, 2006 7:06 am    Post subject: Re: URLEncode and Unicode Reply with quote




"Hamid" <hrz_mir (AT) Yahoo (DOT) com> wrote


Quote:
I'm using TNMURL to encode a url, but seemingly the component
fails to encode urls containing Unicode characters.

That is not surprising. Most of the VCL in general, and thus most
third-party components, cannot work with Unicode to begin with

Quote:
How can I solve the problem?

Don't use the NetMasters components. Which you should not be using anyway,
because it is notoriously buggy and problematic in general.


Gambit



Back to top
Mark Jacobs
Guest





PostPosted: Tue Jan 31, 2006 4:15 pm    Post subject: Re: URLEncode and Unicode Reply with quote



Hamid wrote:
Quote:
I'm using TNMURL to encode a url, but seemingly the component fails to encode urls containing Unicode characters. How can I solve the problem?

Here are a couple of routines. I'll leave you to work them out, and fire questions at this
post :-

AnsiString mjunescape(AnsiString webstr,bool dopls)
{
int ii,jj=webstr.Length(),kk,mm; AnsiString retv="",pschs="0123456789ABCDEF"; char ch;
for (ii=1;ii<=jj;++ii)
{
ch=webstr[ii]; if (ch=='+' && dopls) { retv+=" "; continue;}
if (ch!='%') { retv+=ch; continue;}
if (ii if (ii {
kk=pschs.Pos((char)toupper(webstr[ii+1]));
mm=pschs.Pos((char)toupper(webstr[ii+2]));
if (kk>0 && mm>0) { retv+=(char)((kk-1)*16+mm-1); ii+=2;} else retv+=ch;
}
}
return retv;
}

AnsiString mjescape(AnsiString webstr,bool dospc)
{
int ii,jj=webstr.Length(); AnsiString retv=""; char ch;
AnsiString
pschs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789*@._-$!'()%";
for (ii=1;ii<=jj;++ii)
{
ch=webstr[ii]; if (ch==' ' && dospc) { retv+="+"; continue;}
if (pschs.Pos(ch)>0) retv+=ch; else retv+="%"+IntToHex(ch,2);
}
return retv;
}


--
Mark Jacobs
http://www.dkcomputing.co.uk

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Socket) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.