Skip to content

Commit

Permalink
Replace URLEncoder.encode() with Uri.encode()
Browse files Browse the repository at this point in the history
URLEncoder.encode() encodes ' ' as '+' and that's not handled by
all email apps. Uri.encode() uses "%20" for ' '.
  • Loading branch information
robho committed Dec 1, 2024
1 parent 5cc8322 commit 6c15446
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/net/vonforst/evmap/api/nobil/NobilModel.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.vonforst.evmap.api.nobil

import android.net.Uri
import androidx.core.text.HtmlCompat
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
Expand All @@ -16,7 +17,6 @@ import net.vonforst.evmap.model.OpeningHours
import net.vonforst.evmap.model.ReferenceData
import net.vonforst.evmap.model.getBooleanValue
import net.vonforst.evmap.model.getSliderValue
import java.net.URLEncoder
import java.time.Instant
import java.time.LocalDateTime

Expand Down Expand Up @@ -115,7 +115,7 @@ data class NobilChargerStation(
null,
when (chargerStationData.landCode) {
"SWE" -> "https://www.energimyndigheten.se/klimat/transporter/laddinfrastruktur/registrera-din-laddstation/elbilsagare/"
else -> "mailto:[email protected]?subject=" + URLEncoder.encode("Regarding charging station " + chargerStationData.internationalId, "UTF-8").replace("+", "%20")
else -> "mailto:[email protected]?subject=" + Uri.encode("Regarding charging station " + chargerStationData.internationalId)
},
null,
chargerStationData.ocpiId != null ||
Expand Down

0 comments on commit 6c15446

Please sign in to comment.