Hi. I'm trying to load an image using `KamelImage`...
# multiplatform
s
Hi. I'm trying to load an image using
KamelImage
and
Ktor
with following url:
"<https://marketmlm.com/wp-content/uploads/2023/08/اعتماد-به-نفس-رابین-شارما-700.png>"
As you see it contains Asscii Char and needs to be converted to UTF-8. In android I used to fix this with
URLEncoder
but its not available in kmp. Any solution?
Copy code
io.ktor.http.URLParserException: Fail to parse url: "<https://marketmlm.com/wp-content/uploads/2023/08/اعتماد-به-نفس-رابین-شارما-700.png>"
I fixed the problem. Apparently Ktor has a extantion fun called _encodeURLPath_() . but it convert the
"
from string to
%22
. So i create an function and fix the problem:
Copy code
fun String.encodeUrl(): String {
    return this.encodeURLPath().replace("%22","")
}
e
I guess it's accepted anyway because web standards are pretty lax… thanks, postel's law
🙌 1