How about:

    case (k, v) => URLEncoder.encode(k, "UTF-8") + Option(v).map("=" + URLEncoder.encode(_, "UTF-8")).getOrElse("")