The escaped file names are escaped like a regular URL link in a browser. Also, the escaped file names are already UTF-8 encoded and escaped characters are UTF-8 escaped characters. So, I’ve found the utility function (from POCO library) that unescapes escaped strings (I’ve adopted it to JUCE a little bit). And it works for me!
[code]String unescape(const String& str)
{
std::string instr(str);
std::string::const_iterator it = instr.begin();
std::string::const_iterator end = instr.end();
std::string decodedStr;
while (it != end)
{
char c = *it++;
if (c == '%')
{
if (it == end) break;
char hi = *it++;
if (it == end) break;
char lo = *it++;
if (hi >= '0' && hi <= '9')
c = hi - '0';
else if (hi >= 'A' && hi <= 'F')
c = hi - 'A' + 10;
else if (hi >= 'a' && hi <= 'f')
c = hi - 'a' + 10;
else break;
c *= 16;
if (lo >= '0' && lo <= '9')
c += lo - '0';
else if (lo >= 'A' && lo <= 'F')
c += lo - 'A' + 10;
else if (lo >= 'a' && lo <= 'f')
c += lo - 'a' + 10;
else break;
}
decodedStr += c;
}
#if defined(POSIX)
return String::fromUTF8((const uint8*)decodedStr.c_str());
#elif defined(WINDOWS)
return String(decodedStr.c_str());
#endif
}[/code]