Hello, I’d like to URL encode / decode Strings in ...
# compose-web
s
Hello, I’d like to URL encode / decode Strings in a simple compose-web only project. What would be the most sane way to do so? Coming from Java,
java.net.URI
is not accessible, obviously 🤔
o
there is decodeURI() and encodeURI() in js https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURI if they are not available in kjs-stdlib, they can be used by declaring them as external functions: external fun decodeURI(): String external fun encodeURI(): String
🙏 1
s
Found it. It seems to one has to define the JS functions themselves
Copy code
external fun decodeURIComponent(encodedURI: String): String
external fun encodeURIComponent(str: String): String
@Oleksandr Karpovich [JB] yes found it in this second 😄 Thanks
😄 1
g
If you want a Kotlin multiplatform approach, check out https://github.com/korlibs/krypto
🙏 1
104 Views