Discussion:
Bug in InternetCanonicalizeUrlW in converting Unicode characters ?
(too old to reply)
Ravik
2006-03-09 00:59:29 UTC
Permalink
There seems to be a problem in this function, I'd expect it to either escape
or convert to utf-8 some of the unicode characters. For example, in the
following sample



// test app to call the widechar version of url functions, showing bug in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>

void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}

If you run it on US locale, you get this output:

UrlPath len = 4: 43 3a 5c ff11

And on Japanese locale, this output:

UrlPath len = 4: 43 3a 5c 45



Thanks for any information.
--
Ravi K.
Scherbina Vladimir
2006-03-09 08:36:16 UTC
Permalink
Ravik, under windows server 2k3 I even cannot execute your code - I get
FALSE and GetLastError 0x00000057 - "The parameter is incorrect" after
invoking InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
There seems to be a problem in this function, I'd expect it to either escape
or convert to utf-8 some of the unicode characters. For example, in the
following sample
// test app to call the widechar version of url functions, showing bug in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}
UrlPath len = 4: 43 3a 5c ff11
UrlPath len = 4: 43 3a 5c 45
Thanks for any information.
--
Ravi K.
Ravik
2006-03-09 20:01:30 UTC
Permalink
Thanks for looking into it,


I should add more information on my environment:

I am running on XP, Sp2, with IE 6.0.2900.2180

I'm also using Visual Studio 2005 (VC++ 2005).

Maybe these parameters are making the difference ?

I still see the problem on my machine.. i.e. it returns 'TRUE', and does not
canonicalize the unicode strings properly, and neither does it return an
error, which would also be acceptable.
--
Ravi K.
Post by Scherbina Vladimir
Ravik, under windows server 2k3 I even cannot execute your code - I get
FALSE and GetLastError 0x00000057 - "The parameter is incorrect" after
invoking InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
There seems to be a problem in this function, I'd expect it to either escape
or convert to utf-8 some of the unicode characters. For example, in the
following sample
// test app to call the widechar version of url functions, showing bug in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}
UrlPath len = 4: 43 3a 5c ff11
UrlPath len = 4: 43 3a 5c 45
Thanks for any information.
--
Ravi K.
Scherbina Vladimir
2006-03-09 20:52:41 UTC
Permalink
Strange, but the same occures when I run your example on home machine (XP
SP2)...
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Thanks for looking into it,
I am running on XP, Sp2, with IE 6.0.2900.2180
I'm also using Visual Studio 2005 (VC++ 2005).
Maybe these parameters are making the difference ?
I still see the problem on my machine.. i.e. it returns 'TRUE', and does not
canonicalize the unicode strings properly, and neither does it return an
error, which would also be acceptable.
--
Ravi K.
Post by Scherbina Vladimir
Ravik, under windows server 2k3 I even cannot execute your code - I get
FALSE and GetLastError 0x00000057 - "The parameter is incorrect" after
invoking InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
There seems to be a problem in this function, I'd expect it to either escape
or convert to utf-8 some of the unicode characters. For example, in the
following sample
// test app to call the widechar version of url functions, showing bug in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}
UrlPath len = 4: 43 3a 5c ff11
UrlPath len = 4: 43 3a 5c 45
Thanks for any information.
--
Ravi K.
Scherbina Vladimir
2006-03-09 21:59:32 UTC
Permalink
Can you send me (to my e-mail) your version of wininet.dll ?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Thanks for looking into it,
I am running on XP, Sp2, with IE 6.0.2900.2180
I'm also using Visual Studio 2005 (VC++ 2005).
Maybe these parameters are making the difference ?
I still see the problem on my machine.. i.e. it returns 'TRUE', and does not
canonicalize the unicode strings properly, and neither does it return an
error, which would also be acceptable.
--
Ravi K.
Post by Scherbina Vladimir
Ravik, under windows server 2k3 I even cannot execute your code - I get
FALSE and GetLastError 0x00000057 - "The parameter is incorrect" after
invoking InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
There seems to be a problem in this function, I'd expect it to either escape
or convert to utf-8 some of the unicode characters. For example, in the
following sample
// test app to call the widechar version of url functions, showing bug in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}
UrlPath len = 4: 43 3a 5c ff11
UrlPath len = 4: 43 3a 5c 45
Thanks for any information.
--
Ravi K.
Ravik
2006-03-10 01:39:10 UTC
Permalink
Here's the information on my wininet.dll:



Path: C:\WINDOWS\system32\wininet.dll
Version: 6.00.2900.2781 (xpsp_sp2_gdr.051020-1730)
Timestamp: 10/20/2005 7:39 PM


Thanks again for looking into it!

-Ravi
--
Ravi K.
Post by Scherbina Vladimir
Can you send me (to my e-mail) your version of wininet.dll ?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Thanks for looking into it,
I am running on XP, Sp2, with IE 6.0.2900.2180
I'm also using Visual Studio 2005 (VC++ 2005).
Maybe these parameters are making the difference ?
I still see the problem on my machine.. i.e. it returns 'TRUE', and does not
canonicalize the unicode strings properly, and neither does it return an
error, which would also be acceptable.
--
Ravi K.
Post by Scherbina Vladimir
Ravik, under windows server 2k3 I even cannot execute your code - I get
FALSE and GetLastError 0x00000057 - "The parameter is incorrect" after
invoking InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
There seems to be a problem in this function, I'd expect it to either escape
or convert to utf-8 some of the unicode characters. For example, in the
following sample
// test app to call the widechar version of url functions, showing bug in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}
UrlPath len = 4: 43 3a 5c ff11
UrlPath len = 4: 43 3a 5c 45
Thanks for any information.
--
Ravi K.
Scherbina Vladimir
2006-03-10 06:11:49 UTC
Permalink
My version of wininet is 6.0.2900.2180. Btw, I am still waiting for your
wininet.dll. It's interesting to look on implementation of
InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Path: C:\WINDOWS\system32\wininet.dll
Version: 6.00.2900.2781 (xpsp_sp2_gdr.051020-1730)
Timestamp: 10/20/2005 7:39 PM
Thanks again for looking into it!
-Ravi
--
Ravi K.
Post by Scherbina Vladimir
Can you send me (to my e-mail) your version of wininet.dll ?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Thanks for looking into it,
I am running on XP, Sp2, with IE 6.0.2900.2180
I'm also using Visual Studio 2005 (VC++ 2005).
Maybe these parameters are making the difference ?
I still see the problem on my machine.. i.e. it returns 'TRUE', and
does
not
canonicalize the unicode strings properly, and neither does it return an
error, which would also be acceptable.
--
Ravi K.
Post by Scherbina Vladimir
Ravik, under windows server 2k3 I even cannot execute your code - I get
FALSE and GetLastError 0x00000057 - "The parameter is incorrect" after
invoking InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
There seems to be a problem in this function, I'd expect it to
either
escape
or convert to utf-8 some of the unicode characters. For example, in the
following sample
// test app to call the widechar version of url functions, showing
bug
in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}
UrlPath len = 4: 43 3a 5c ff11
UrlPath len = 4: 43 3a 5c 45
Thanks for any information.
--
Ravi K.
Ravik
2006-03-10 19:07:30 UTC
Permalink
Hi,

Thanks a lot, again, for your time looking into it!

I don't think I can send the binary wininet.dll to you directly, due to
license/redistribution issues with Internet Explorer and its components.

If you had the time - you could try download the latest IE if possible..

If someone from Microsoft can speak to this - or give Vladimir the dll, that
would be great.


thanks
--
Ravi K.
Post by Scherbina Vladimir
My version of wininet is 6.0.2900.2180. Btw, I am still waiting for your
wininet.dll. It's interesting to look on implementation of
InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Path: C:\WINDOWS\system32\wininet.dll
Version: 6.00.2900.2781 (xpsp_sp2_gdr.051020-1730)
Timestamp: 10/20/2005 7:39 PM
Thanks again for looking into it!
-Ravi
--
Ravi K.
Post by Scherbina Vladimir
Can you send me (to my e-mail) your version of wininet.dll ?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Thanks for looking into it,
I am running on XP, Sp2, with IE 6.0.2900.2180
I'm also using Visual Studio 2005 (VC++ 2005).
Maybe these parameters are making the difference ?
I still see the problem on my machine.. i.e. it returns 'TRUE', and
does
not
canonicalize the unicode strings properly, and neither does it return an
error, which would also be acceptable.
--
Ravi K.
Post by Scherbina Vladimir
Ravik, under windows server 2k3 I even cannot execute your code - I get
FALSE and GetLastError 0x00000057 - "The parameter is incorrect" after
invoking InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
There seems to be a problem in this function, I'd expect it to
either
escape
or convert to utf-8 some of the unicode characters. For example, in the
following sample
// test app to call the widechar version of url functions, showing
bug
in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}
UrlPath len = 4: 43 3a 5c ff11
UrlPath len = 4: 43 3a 5c 45
Thanks for any information.
--
Ravi K.
Scherbina Vladimir
2006-03-11 00:26:42 UTC
Permalink
OK, I will try to get latest version and make researches, but for now let's
choose another way - what happens if you use CoInternetParseUrl with the
action PARSE_CANONICALIZE and the flag URL_ESCAPE_UNSAFE or UrlCanonicalize
?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Hi,
Thanks a lot, again, for your time looking into it!
I don't think I can send the binary wininet.dll to you directly, due to
license/redistribution issues with Internet Explorer and its components.
If you had the time - you could try download the latest IE if possible..
If someone from Microsoft can speak to this - or give Vladimir the dll, that
would be great.
thanks
--
Ravi K.
Post by Scherbina Vladimir
My version of wininet is 6.0.2900.2180. Btw, I am still waiting for your
wininet.dll. It's interesting to look on implementation of
InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Path: C:\WINDOWS\system32\wininet.dll
Version: 6.00.2900.2781 (xpsp_sp2_gdr.051020-1730)
Timestamp: 10/20/2005 7:39 PM
Thanks again for looking into it!
-Ravi
--
Ravi K.
Post by Scherbina Vladimir
Can you send me (to my e-mail) your version of wininet.dll ?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Thanks for looking into it,
I am running on XP, Sp2, with IE 6.0.2900.2180
I'm also using Visual Studio 2005 (VC++ 2005).
Maybe these parameters are making the difference ?
I still see the problem on my machine.. i.e. it returns 'TRUE', and
does
not
canonicalize the unicode strings properly, and neither does it
return
an
error, which would also be acceptable.
--
Ravi K.
Post by Scherbina Vladimir
Ravik, under windows server 2k3 I even cannot execute your code - I get
FALSE and GetLastError 0x00000057 - "The parameter is incorrect" after
invoking InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
There seems to be a problem in this function, I'd expect it to
either
escape
or convert to utf-8 some of the unicode characters. For example,
in
the
following sample
// test app to call the widechar version of url functions, showing
bug
in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}
UrlPath len = 4: 43 3a 5c ff11
UrlPath len = 4: 43 3a 5c 45
Thanks for any information.
--
Ravi K.
Ravik
2006-03-15 20:07:28 UTC
Permalink
Thanks for your suggestion, I tried out the api you suggested - i.e.

HRESULT retval = ::CoInternetParseUrl(wszName,
PARSE_CANONICALIZE, URL_ESCAPE_UNSAFE,
buf, dsize, &dsize, 0);

but - it still return S_OK - and does not escape the the non Ascii
characters.
--
Ravi K.
Post by Scherbina Vladimir
OK, I will try to get latest version and make researches, but for now let's
choose another way - what happens if you use CoInternetParseUrl with the
action PARSE_CANONICALIZE and the flag URL_ESCAPE_UNSAFE or UrlCanonicalize
?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Hi,
Thanks a lot, again, for your time looking into it!
I don't think I can send the binary wininet.dll to you directly, due to
license/redistribution issues with Internet Explorer and its components.
If you had the time - you could try download the latest IE if possible..
If someone from Microsoft can speak to this - or give Vladimir the dll, that
would be great.
thanks
--
Ravi K.
Post by Scherbina Vladimir
My version of wininet is 6.0.2900.2180. Btw, I am still waiting for your
wininet.dll. It's interesting to look on implementation of
InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Path: C:\WINDOWS\system32\wininet.dll
Version: 6.00.2900.2781 (xpsp_sp2_gdr.051020-1730)
Timestamp: 10/20/2005 7:39 PM
Thanks again for looking into it!
-Ravi
--
Ravi K.
Post by Scherbina Vladimir
Can you send me (to my e-mail) your version of wininet.dll ?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Thanks for looking into it,
I am running on XP, Sp2, with IE 6.0.2900.2180
I'm also using Visual Studio 2005 (VC++ 2005).
Maybe these parameters are making the difference ?
I still see the problem on my machine.. i.e. it returns 'TRUE', and
does
not
canonicalize the unicode strings properly, and neither does it
return
an
error, which would also be acceptable.
--
Ravi K.
Post by Scherbina Vladimir
Ravik, under windows server 2k3 I even cannot execute your code - I get
FALSE and GetLastError 0x00000057 - "The parameter is incorrect" after
invoking InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
There seems to be a problem in this function, I'd expect it to
either
escape
or convert to utf-8 some of the unicode characters. For example,
in
the
following sample
// test app to call the widechar version of url functions, showing
bug
in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}
UrlPath len = 4: 43 3a 5c ff11
UrlPath len = 4: 43 3a 5c 45
Thanks for any information.
--
Ravi K.
Scherbina Vladimir
2006-03-15 20:48:23 UTC
Permalink
What about UrlCanonicalize ?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Thanks for your suggestion, I tried out the api you suggested - i.e.
HRESULT retval = ::CoInternetParseUrl(wszName,
PARSE_CANONICALIZE, URL_ESCAPE_UNSAFE,
buf, dsize, &dsize, 0);
but - it still return S_OK - and does not escape the the non Ascii
characters.
--
Ravi K.
Post by Scherbina Vladimir
OK, I will try to get latest version and make researches, but for now let's
choose another way - what happens if you use CoInternetParseUrl with the
action PARSE_CANONICALIZE and the flag URL_ESCAPE_UNSAFE or
UrlCanonicalize
?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Hi,
Thanks a lot, again, for your time looking into it!
I don't think I can send the binary wininet.dll to you directly, due to
license/redistribution issues with Internet Explorer and its components.
If you had the time - you could try download the latest IE if possible..
If someone from Microsoft can speak to this - or give Vladimir the dll, that
would be great.
thanks
--
Ravi K.
Post by Scherbina Vladimir
My version of wininet is 6.0.2900.2180. Btw, I am still waiting for your
wininet.dll. It's interesting to look on implementation of
InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Path: C:\WINDOWS\system32\wininet.dll
Version: 6.00.2900.2781 (xpsp_sp2_gdr.051020-1730)
Timestamp: 10/20/2005 7:39 PM
Thanks again for looking into it!
-Ravi
--
Ravi K.
Post by Scherbina Vladimir
Can you send me (to my e-mail) your version of wininet.dll ?
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
Thanks for looking into it,
I am running on XP, Sp2, with IE 6.0.2900.2180
I'm also using Visual Studio 2005 (VC++ 2005).
Maybe these parameters are making the difference ?
I still see the problem on my machine.. i.e. it returns 'TRUE', and
does
not
canonicalize the unicode strings properly, and neither does it
return
an
error, which would also be acceptable.
--
Ravi K.
Post by Scherbina Vladimir
Ravik, under windows server 2k3 I even cannot execute your
code - I
get
FALSE and GetLastError 0x00000057 - "The parameter is
incorrect"
after
invoking InternetCanonicalizeUrlW.
--
Vladimir
http://spaces.msn.com/vladimir-scherbina/
Post by Ravik
There seems to be a problem in this function, I'd expect it to
either
escape
or convert to utf-8 some of the unicode characters. For example,
in
the
following sample
// test app to call the widechar version of url functions, showing
bug
in
Japanese locale
#include <windows.h>
#include <wininet.h>
#include <stdio.h>
void main()
{
wchar_t buf[1024];
DWORD dsize = _countof(buf);
wchar_t wszName[] = {L'C', L':', L'\\', 0xff11, 0};
BOOL b = ::InternetCanonicalizeUrlW(wszName, buf, &dsize, 0);
if (b) {
URL_COMPONENTSW uc;
memset(&uc, 0, sizeof(uc)); // default all fields to null
wchar_t wszUrlPath[200];
uc.lpszUrlPath = wszUrlPath;
uc.dwUrlPathLength = _countof(wszUrlPath);
BOOL b2 = ::InternetCrackUrlW(buf, 0, 0, &uc);
if (b2) {
printf("UrlPath len = %d: ", uc.dwUrlPathLength);
for (int i = 0; i < uc.dwUrlPathLength; i++) {
printf(" %x", wszUrlPath[i]);
}
printf("\n");
}
}
}
UrlPath len = 4: 43 3a 5c ff11
UrlPath len = 4: 43 3a 5c 45
Thanks for any information.
--
Ravi K.
Loading...