 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Hamid Guest
|
Posted: Sun Jan 29, 2006 6:09 am Post subject: URLEncode and Unicode |
|
|
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
|
Posted: Mon Jan 30, 2006 7:06 am Post subject: Re: URLEncode and Unicode |
|
|
"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
|
Posted: Tue Jan 31, 2006 4:15 pm Post subject: Re: URLEncode and Unicode |
|
|
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 |
|
 |
|
|
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
|
|