File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
model-client/src/commonTest/kotlin/org/modelix/model
model-datastructure/src/jsMain/kotlin/org/modelix/model/persistent Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,16 @@ class SerializationUtilEscapeTest {
22
22
assertEquals(" " , SerializationUtil .escape(" " ))
23
23
}
24
24
25
+ @Test
26
+ fun escape_space () {
27
+ assertEquals(" +" , SerializationUtil .escape(" " ))
28
+ }
29
+
30
+ @Test
31
+ fun unescape_space () {
32
+ assertEquals(" " , SerializationUtil .unescape(" +" ))
33
+ }
34
+
25
35
@Test
26
36
fun unescape_emptyString () {
27
37
assertEquals(" " , SerializationUtil .unescape(" " ))
Original file line number Diff line number Diff line change @@ -18,14 +18,16 @@ actual object SerializationUtil {
18
18
if (value == null ) {
19
19
return NULL_ENCODING
20
20
}
21
- return encodeURIComponent(value).map { SPECIAL_ENCODING [it] ? : it.toString() }.joinToString(separator = " " )
21
+ return encodeURIComponent(value).asSequence()
22
+ .joinToString(separator = " " ) { SPECIAL_ENCODING [it] ? : it.toString() }
23
+ .replace(" %20" , " +" )
22
24
}
23
25
24
26
actual fun unescape (value : String? ): String? {
25
27
if (value == NULL_ENCODING ) {
26
28
return null
27
29
}
28
- return decodeURIComponent(value!! )
30
+ return decodeURIComponent(value!! .replace( " + " , " " ) )
29
31
}
30
32
31
33
actual fun longToHex (value : Long ): String {
You can’t perform that action at this time.
0 commit comments