Open
Description
zan77137 (@shoo) reported this on 2020-07-21T14:15:56Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=21064
Description
Some of the functions provided by std.net.curl handle paths, such as setCookieJar and caInfo. But they cannot handle the non-ASCII paths.
-----------------
import std;
void makeCookieFile(string dir)
{
if (!dir.exists)
mkdirRecurse(dir);
auto client = HTTP();
client.setCookieJar(dir.buildPath("cookie.txt"));
get("https://dlang.org", client);
}
void main()
{
auto asciiPath = "abcde";
auto nonAsciiPath = "あいうえお";
makeCookieFile(asciiPath);
makeCookieFile(nonAsciiPath);
// Assertion failure, the nonAsciiPath is not including anything
assert(dirEntries(asciiPath, SpanMode.shallow).map!"a.name".equal(
dirEntries(nonAsciiPath, SpanMode.shallow).map!"a.name"));
}
-----------------
core.exception.AssertError@src\main.d(19): Assertion failure
-----------------
I did a little research, but I couldn't figure out what character code should be passed to Curl... Probably that is the system-dependent MBCS(NOT UTF-8).
https://curl.haxx.se/libcurl/c/CURLOPT_COOKIEJAR.html