Show UTF-8 folder/file names on a EditBox

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,
I have the following code :
<pre class="prettyprint BROWSEINFO bi;
LPITEMIDLIST il;
char Folder[MAX_PATH];
int ret;
LPMALLOC pMalloc;


strcpy(Folder, Path);
bi.hwndOwner = hWnd;
bi.pidlRoot = NULL;
bi.pszDisplayName = Folder;
bi.lpszTitle = Title;
bi.ulFlags = Flags;
bi.lpfn = NULL;
bi.lParam = 0;
bi.iImage = 0;
if(il = SHBrowseForFolder(&bi))
{
ret = SHGetPathFromIDList(il, Path);
if(SHGetMalloc(&pMalloc) == NOERROR)
pMalloc->lpVtbl->Free(pMalloc, il);
return(ret);
}
else
return(0);[/code]
<br/>
The Path which is a pointe to a "wchar_t *" should hold the name of the folder and will be displayed in the Editbox as the chosen folder. Now if the folder name is a UTF-8 string the Path will hold only "????????" characters. I have the same problem
with file selection GetOpenFileName() .
My question is how/what should I do to correctly handle the UTF-8 file/folder names and show them correctly inside the EditBox.

with regards,
ehsan



View the full article
 
Back
Top