DNS GET return escaped?

Using unauthorised API DNS GET, I receive an escaped string rather than the normal raw string literal.

    let res = ::request::get(&url, &mut headers );
    println!( "\n{:?}", res.body);


"<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n<meta name=\"keywords\" content=

where I want

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content=

Is that expected and is there an obvious fix, to see the normal file unescaped?

1 Like

Standard formatter {} instead of debug formatter {:?} gives what you want.


    let res = "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
    println!("Debug formatter:\n{:?}", res);
    println!("Standard formatter:\n{}", res);


Debug formatter:
"<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"
Standard formatter:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

This topic was automatically closed after 2 days. New replies are no longer allowed.