Skip to content

Commit c87cf07

Browse files
Fix utf8 interpolation
1 parent 21b4811 commit c87cf07

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

IntegrationTests/JavaScriptKitExec/Sources/JavaScriptKitExec/main.swift

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Literal_Conversion: do {
66
.boolean(true),
77
.boolean(false),
88
.string("foobar"),
9+
.string("👨‍👩‍👧‍👧 Family Emoji"),
910
.number(0),
1011
.number(.max),
1112
.number(.min),

Runtime/src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,11 @@ export class SwiftRuntime {
206206
}
207207
}
208208
case "string": {
209+
const bytes = textEncoder.encode(value);
209210
return {
210211
kind: JavaScriptValueKind.String,
211212
payload1: this.heap.allocHeap(value),
212-
payload2: value.length,
213+
payload2: bytes.length,
213214
}
214215
}
215216
case "undefined": {

0 commit comments

Comments
 (0)