All Downloads are FREE. Search and download functionalities are using the official Maven repository.

japgolly.webapputil.http.UrlEncoder.scala Maven / Gradle / Ivy

There is a newer version: 2.0.0-RC12
Show newest version
package japgolly.webapputil.http

import scala.scalajs.js.URIUtils

object UrlEncoder extends UrlEncoderApi {

  override def encode(s: String): String =
    URIUtils.encodeURIComponent(s)
      .replace("%20", "+") // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#description

  override def decode(s: String): String =
    URIUtils.decodeURIComponent(
      s.replace('+', ' ') // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#decoding_query_parameters_from_a_url
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy