Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2006 Jan : InternetCreateUrl, InternetCrackUrl, ERROR_INTERNET_INVALID_URL
| Subject: | InternetCreateUrl, InternetCrackUrl, ERROR_INTERNET_INVALID_URL |
| Posted by: | "Roman Ryl..." (rylts..@gmail.com) |
| Date: | 11 Jan 2006 09:28:16 |
Hi,
This should be a simple issue however I did not find in newgroup
search. I have an FTP URL with embedded username, which in its turn
contains '@', something like:
'ftp://' <user@domain.com> ':' <password> '@' <server.com> </path...>
The problem is that InternetCreateUrl does not replace '@' character
with %40 and InternetCrackUrl subsequently fails. ICU_ENCODE flags does
not seem to make InternetCreateUrl convert the character, however if
the replacemed manually, InternetCrackUrl does decode correctly.
My question is whether there is a more correct solution than replace
'@' manually like I do now:
LPCTSTR pszUserName = ... ; // input
CString sUserNameEx;
if(_tcschr(pszUserName, _T('@')))
{
sUserNameEx = pszUserName;
sUserNameEx.Replace(_T("@"), _T("%40"));
pszUserName = sUserNameEx;
}
Roman