Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
Windows Shell
Shell Reference
Path Functions
 UrlUnescape function
UrlUnescape function

Converts escape sequences back into ordinary characters.

Syntax

HRESULT UrlUnescape(
  __inout      PTSTR pszURL,
  __out_opt    PTSTR pszUnescaped,
  __inout_opt  DWORD *pcchUnescaped,
  DWORD dwFlags
);

Parameters

pszURL [in, out]

Type: PTSTR

A pointer to a null-terminated string with the URL. If dwFlags is set to URL_UNESCAPE_INPLACE, the converted string is returned through this parameter.

pszUnescaped [out, optional]

Type: PTSTR

A pointer to a buffer that will receive a null-terminated string that contains the unescaped version of pszURL. If URL_UNESCAPE_INPLACE is set in dwFlags, this parameter is ignored.

pcchUnescaped [in, out, optional]

Type: DWORD*

The number of characters in the buffer pointed to by pcchUnescaped. On entry, the value pcchUnescaped points to is set to the size of the buffer. If the function returns a success code, the value that pcchUnescaped points to is set to the number of characters written to that buffer, not counting the terminating NULL character. If an E_POINTER error code is returned, the buffer was too small, and the value to which pcchUnescaped points is set to the required number of characters that the buffer must be able to contain. If any other errors are returned, the value to which pcchUnescaped points is undefined.

dwFlags

Type: DWORD

Flags that control which characters are unescaped. It can be a combination of the following flags.

URL_DONT_UNESCAPE_EXTRA_INFO

Do not convert the # or ? character, or any characters following them in the string.

URL_UNESCAPE_INPLACE

Use pszURL to return the converted string instead of pszUnescaped.

Return value

Type: HRESULT

Returns S_OK if successful. If the URL_UNESCAPE_INPLACE flag is not set, the value pointed to by pcchUnescaped will be set to the number of characters in the output buffer pointed to by pszUnescaped. Returns E_POINTER if the URL_UNESCAPE_INPLACE flag is not set and the output buffer is too small. The pcchUnescaped parameter will be set to the required buffer size. Otherwise, returns a standard error value.

Remarks

An escape sequence has the form "%xy".

Input strings cannot be longer than INTERNET_MAX_URL_LENGTH.

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP

Minimum supported server

Windows 2000 Server

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 5.0 or later)

Unicode and ANSI names

UrlUnescapeW (Unicode) and UrlUnescapeA (ANSI)

 

 

Send comments about this topic to Microsoft

Build date: 9/7/2011

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Typo in parameter description      ErikEckhardt   |   Edit   |   Show History
It says pcchUnescaped is "the number of characters in the buffer pointed to by pcchUnescaped." Surely it should be "pointed to by pszUnescaped"?
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker