[API reference](https://evolu.dev/docs/api-reference) › [@evolu/sqlite-wasm](https://evolu.dev/docs/api-reference/sqlite-wasm) › writeUtf8

```ts
function writeUtf8(
  deps: SqliteWasmDep,
): (value: string, ptr: WasmPtr, capacity: number) => number;
```

Defined in: [packages/sqlite-wasm/src/Memory.ts:88](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Memory.ts#L88)

Encodes a string as UTF-8 into existing memory and returns the byte length,
without a NUL terminator.

The memory needs up to three bytes per UTF-16 code unit; text that does not
fit is cut at a character boundary, so reserve `value.length * 3` bytes. A
lone surrogate becomes U+FFFD, as in [allocCString](https://evolu.dev/docs/api-reference/sqlite-wasm/functions/allocCString).